Guest
May 20, 2012, 4:00 pm UTCHome arrow Commands arrow Wolfscript arrow Date & Time arrow Wolfscript arrow Date & Time
header image
Date & Time
Written by Dream Dancer   
Apr 16, 2008 at 07:41 AM

The Date & Time functions are unique to Wolfscript, there's no equivalent functions available in Botscript directly, and the formatting of the values returned by Wolfscript over what you get from the Botscript variables is different.

DATE()
No Parameters
Returns the current date formatted "according to the short date format recognized by your computer".
DATEADD(Interval Number Date)
0 Interval
1 Number
2 [bo]Date[/bo]
DATEADD(Interval Number [bo]Date[/bo])
Takes the optionally provided date and adds the type of interval of the number provided to that date.

Theinterval argument has these settings:

You can use either positive or negative numbers for the math.
DATEDIFF(Interval Date1 [bo]Date2[/bo])
0 Interval
1 Date1
2 [bo]Date2[/bo]
DATEDIFF(Interval Date1 [bo]Date2[/bo])Determines the difference between two dates, the second being optional and defaults to NOW() if not provided. See DATEADD for the table of modes which may be used for Interval.
Note: If used without the second date, difference will be positive for [bo]date1[/bo] being less than now.
HOUR(Time)
0 Time
Returns the hour of the optional properly formatted time string, or the current hour of the computer, in military hours. Note the use of {Curly Braces} in the second example.
&hour(10:00) = 10 &hour({10:00 PM}) = 22 &hour(22:00) = 22
MDAY(Date)
0 Date
Returns the day of the optionally included date, or today's day. Note the use of {Curly Braces} in the second example.
&mday(1/23/61) = 23
&mday({january 12, 2001}) = 12
MINUTE(Time)
0 Time
Returns the minute of the optionally included time, or the current minute of the computer.
MONTH(Date)
0 Date
Returns the numerical month of the optionally included date, or today's month. Note the use of {Curly Braces} in the second example, shorthand notation for months works.
&month(6/23/61) = 6
&month({feb 12, 2001}) = 2
SHORTYEAR(Date)
0 Date
Returns the right two digits of the optionally included date, or of the current year.
TIME()
No Parameters
Returns the current computer time.
UNIX2WINDOWTIME(unixtimestamp)
0 unixtimestamp
Specifically designed to convert the sys_lastused_date into a formatted date and time entry. It is not adjusted to local time, timestamp is GMT.
WDAY(Date Abbreviate)
WEEKDAYNAME(Date Abbreviate)
0 Date
1 Abbreviate
Returns the weekday name of the optionally included date, or today's weekday, also optionally abbreviating it. The second form is not new as being added for clarity of coding. Remember what I said about spacing matters? Examine the second example.
&wday(1/23/61) = Monday
&wday( TRUE) = Today's Weekday Abbreviated
&weekdayname({february 12, 1961}) = Sunday
WDAYN(Date)
WEEKDAY(Date)
0 Date
Returns the current day of the week, (or optionally included date), based on Monday = 1 and Sunday = 7. Second form is not new as being added for clarity of coding.
YEAR(Date)
0 Date
Returns the four digit year of the optionally included date, or this year according to the computer clock.
Last Updated ( Jan 25, 2011 at 09:47 PM )
<Previous   Next>
header image