✓ 在 REBOL.org 上查看Francois Vanzeveren 的日期时间脚本
如果你加载它,即
do http://www.rebol.org/download-a-script.r?script-name=date-time.r
那么你可以这样做:
>> ? date-dif
USAGE:
DATE-DIF date1 date2 /y /m /d /ym /md /yd
DESCRIPTION:
Returns the difference between two dates.
DATE-DIF is a function value.
ARGUMENTS:
date1 -- (Type: date)
date2 -- (Type: date)
REFINEMENTS:
/y -- Returns the number of complete years between @date1
and @date2.
/m -- Returns the number of complete months between @date
1 and @date2.
/d -- Returns the number of complete days between @date1
and @date2.
/ym -- Returns the number of full months between @date1 a
nd @date2,
not including the difference in years.
/md -- Returns the number of full days between @date1 and
@date2,
not including the difference in months.
/yd -- Returns the number of full days between @date1 and
@date2,
not including the difference in years.
✓ >> ? now
查看日期的 /refinements
>> ? now
USAGE:
NOW /year /month /day /time /zone /date /weekday /yearday
/precise
DESCRIPTION:
Returns the current local date and time.
NOW is a native value.
REFINEMENTS:
/year -- Returns the year only.
/month -- Returns the month only.
/day -- Returns the day of the month only.
/time -- Returns the time only.
/zone -- Returns the time zone offset from GMT only.
/date -- Returns date only.
/weekday -- Returns day of the week as integer (Monday is
day 1).
/yearday -- Returns day of the year (Julian)
/precise -- Use nanosecond precision
例子:
>> d: 27-7-1973
== 27-Jul-1973
>> d/day
== 27
>> d/month
== 7
>> d/year
== 1973