XDate Reference

XDate is to convert a date object into text with various formats.

You can build a date string with fexible object oriented interfaces.

Example

use XDate : script "XDate"

tell XDate's make_with_text("2018/1/5 7:08")
(* predefined format *)
log date_as_text() -- 2018年1月5日金曜日 7:08:00
log w3c_dtf() -- 2018-12-14T19:35:35+09:00
log rfc822() -- Fri, 05 Jan 2018 07:08:00 +0900

(* build custom format *)
set_year_format("long")
set_month_format("number")

log y() & "/" & mo() & "/" & d() & " " & h() & ":" & min() & ":" & sec()
--2018/1/5 7:8:0
set_leading_zero(true)
log y() & "/" & mo() & "/" & d() & " " & h() & ":" & min() & ":" & sec()
-- 2018/01/05 07:08:00
end tell

Constractors

make_with_date

Make a XDate instance from a date object.

make_with_text

Make a XDate instance from a text.

Predefined formats

as_text

Return a text of the date object with the format defined in the system.

date_string

Return a date part of the date object as a text with the format defined in the system.

time_string

Return a time part of the date object as a text with the format defined in the system.

w3c_dtf

Return a string of the date with the "W3C-DTF" format.

rfc822

Return a string of the date with the "RFC822" format.

Obtain parts of date and customize details.

set_year_format

set format of output of the year text returned with y

y

Return year as a text.

set_month_format

set format of output of the month text returned with mo.

mo

Return month as text.

set_leading_zero

set whether month, day, hour, minute and second have a leading zero or not.

d

Return day as text.

set_weekday_format

set the format of weekday returned by w.

w

Return weekday name in English.

h

Return hour as text.

min

Return minute as text.

sec

Return second as text.

time_to_GMT

Return time to GMT as text.