Water 5-Common Data Types-Date and Time | Water Contract<class datetime
year =null=number.integer
month =null=number.integer
day =null=number.integer
hour =null=number.integer
minute =null=number.integer
second =null=number.integer
millisecond =null=number.integer
base =null
date_separator="-"=string
time_separator=":"=string
/> | |
See also: time, date, duration, datetime_interval
datetimes are constructed by passing in a base datetime and the overriding
attributes of that base datetime.
The base datetime defaults to year 1, month 1, day 1, hour 0, minute 0 second 0, millisecond 0.
Thus the call <datetime/> returns a datetime with those defaults.
Example: Overriding the default base datetime
<datetime 2006 08 17 23 26 47 00 />.<to_htm />
 | "Aug 17, 2006 23:26:47" |
A base datetime can be any one of:
- A string such as "Mon Feb 18 2002 20:21:00", "3/22/2002", or "3/24/02"
- A Water datetime object
- A java date object.
If base datetime is a string, any format acceptable by Java's Date constructor that takes a
string argument is legal. Note that any string returned by
some_water_datetime.<to_htm /> is acceptable.
- year Must be a full year integer i.e. 2002. Years are counted from 0 AD, so 2 means two years after 0 AD.
- month an integer between 1 and 12 inclusive
- day an integer between 1 and 31 inclusive
- hour an integer between 0 and 23 inclusive
- minute an integer between 0 and 59 inclusive
- second an integer between 0 and 59 inclusive
- millisecond an integer between 0 and 999 inclusive
Examples of March 22, 2002:
<datetime base="2002/3/22"/>
<datetime 2002 3 24 14 45 46 555/>.<to_rfc_822/>
 | "24-Mar-02 14:45:46 GMT" |
<datetime year=1999 base="2002/3/22"/>
 | <datetime 1999 3 22 0 0 0 0/>
|
Example: returns datetime of the current day and time
datetime.<current/>
Example: returns current date (time of 0:0:0)
date.<current/>
Example: returns current time
time.<current/>
<datetime 2002 10 5 hour=15 10 34/>.<to_htm />
 | "Oct 5, 2002 15:10:34" |
<datetime 2002 10 5/>.<m_d_yy/>
 | "10-5-02" |
<datetime 2002 10 5/>.<mm_dd_yy/>
 | "10-05-02" |
<datetime 2002 10 5/>.<mmm_d_yyyy/>
 | "Oct 5, 2002" |
The datetime class provides many fields and methods to allow a variety of formats for
datetime information. The various fields that may be used in constructing date and time formats
are listed here.
Basic Fields
a wob
| Parameter key | Default value | Type |
| year | null | integer |
<datetime 2006 08 16 12 15 58 445 />.year
 | 2006 |
a wob
| Parameter key | Default value | Type |
| month | null | integer |
<datetime 2006 08 16 12 15 58 445 />.month
 | 8 |
a wob
| Parameter key | Default value | Type |
| day | null | integer |
<datetime 2006 08 16 12 15 58 445 />.day
 | 16 |
a wob
| Parameter key | Default value | Type |
| hour | null | integer |
<datetime 2006 08 16 12 15 58 445 />.hour
 | 12 |
a wob
| Parameter key | Default value | Type |
| minute | null | integer |
<datetime 2006 08 16 12 15 58 445 />.minute
 | 15 |
a wob
| Parameter key | Default value | Type |
| second | null | integer |
<datetime 2006 08 16 12 15 58 445 />.second
 | 58 |
a wob
| Parameter key | Default value | Type |
| millisecond | null | integer |
<datetime 2006 08 16 12 15 58 445 />.millisecond
 | 445 |
Year of the Datetime
a wob
| Parameter key | Default value | Type |
| "yy" | false |
Returns the last two digits of the year as a string.
<datetime 2006 08 16 12 15 58 445 />.yy
 | "06" |
Month of the Year
a wob
| Parameter key | Default value | Type |
| month_name | false | boolean |
<datetime 2006 08 16 12 15 58 445 />.month_name
 | "August" |
a wob
| Parameter key | Default value | Type |
| mmm | false | boolean |
<datetime 2006 08 16 12 15 58 445 />.mmm
 | "Aug" |
a wob
| Parameter key | Default value | Type |
| mm | "" | string |
Returns the month number as a two-digit string.
<datetime 2006 08 16 12 15 58 445 />.mm
 | "08" |
Day of the Month
a wob
| Parameter key | Default value | Type |
| dd | "" | string |
Returns a two-digit day of the month as a string.
<datetime 2006 08 16 12 15 58 445 />.dd
 | "16" |
Day of the Week
a wob
| Parameter key | Default value | Type |
| day_of_week_name | false | boolean |
<datetime 2006 08 16 12 15 58 445 />.day_of_week_name
 | "Wednesday" |
a wob
| Parameter key | Default value | Type |
| "www" | false |
<datetime 2006 08 16 12 15 58 445 />.www
 | "Wed" |
a wob
| Parameter key | Default value | Type |
| ww | false | boolean |
Returns one-or-two letters indicating the day of the
week in the form: "Su" "M " "Tu" "W " "Th" "F " "Sa".
<datetime 2006 08 16 12 15 58 445 />.ww
 | "W " |
a wob
| Parameter key | Default value | Type |
| day_of_week | null |
Returns the day of the week as an integer.
Sunday returns 0.
<datetime 2006 08 16 12 15 58 445 />.day_of_week
 | 3 |
Hour of the Day
a wob
| Parameter key | Default value | Type |
| hh24 | "" | string |
Returns the hour of the day as a two-digit string in 24-hour format.
<datetime 2006 08 16 13 15 58 445 />.hh24
 | "13" |
a wob
| Parameter key | Default value | Type |
| "hh12" | false |
Returns the hour of the day as a two-digit string in 12-hour format.
<datetime 2006 08 16 13 15 58 445 />.hh12
 | "01" |
a wob
| Parameter key | Default value | Type |
| "h12" | false |
Returns the hour of the day as a one- or two-digit string in 12-hour format.
<datetime 2006 08 16 13 15 58 445 />.h12
 | "1" |
Minute of the Hour
a wob
| Parameter key | Default value | Type |
| nn | "" | string |
Returns the minute of the hour as a two-digit string.
<datetime 2006 08 16 13 15 58 445 />.nn
 | "15" |
Seconds of the Minute
a wob
| Parameter key | Default value | Type |
| ss | "" | string |
Returns the seconds as a two-digit string.
<datetime 2006 08 16 12 15 58 445 />.ss
 | "58" |
Determine A.M./P.M.
a wob
| Parameter key | Default value | Type |
| am_pm | "pm" | string |
Returns "am" or "pm" based on the time.
<datetime 2006 08 16 12 15 58 445 />.am_pm
 | "pm" |
a wob
| Parameter key | Default value | Type |
| pm | null |
Returns true if the time is greater than or equal to
12:00:00, otherwise returns false.
<datetime 2006 08 16 12 15 58 445 />.pm
 | true |
© Copyright 2007 Clear Methods, Inc.