El package date contains the group of functions for the data treatment which includes the managing of the sql date, time and timestamp types. It has several dates builders for the differents subtypes of data which includes the management of the time zone. The following table shows the builders for the differents types of date objects with examples of its utilization.

1 Xsql date

Notas

The examples have been represented in a server located in Barcelona [CET] and therefore it is executed in the time zone GMT+1 which corresponds to a offset timezone of 3600000 milliseconds. So, 12:16 in Barcelona will correspond to 11:16 in London [GMT]. In the example, we can see how 12:16 in London is visualized in a server which is being executed in Barcelona as 13:16. It means that all the examples shows the date in GMT+1.

Builders date type
Builder Resulting type Examples
date java.util.Date

<date dd='12' MM='10' yy='2005' />

12-10-2005

<date format='dd-MM-yyyy'>12-10-2005</date>

12-10-2005

date.time java.sql.Time

<date.time hh='12' mm='16' ss='55' />

12:16:55

<date.time hh='12' mm='16' ss='55' Z='0'/>

13:16:55

<date.time format='HH:mm:ss'>12:16:55</date.time>

12:16:55

<date.time>12:16:55</date.time>

12:16:55

date.timestamp java.sql.Timestamp

<date.timestamp dd='12' MM='10' yy='2005' hh='12' mm='16' ss='55' />

2005-10-12 12:16:55.0

<date.timestamp dd='12' MM='10' yy='2005' hh='12' mm='16' ss='55' Z='0'/>

2005-10-12 13:16:55.0

<date.timestamp dd='12' MM='10' yy='2005' Z='0' />

2005-10-12 01:00:00.0

<date.timestamp dd='12' MM='10' yy='2005' Z='3600000' />

2005-10-12 00:00:00.0

<date.timestamp dd='12' MM='10' yy='2005' Z='-3600000' />

2005-10-12 02:00:00.0

<date.timestamp format='dd-MM-yyyy HH:mm:ss'>12-10-2005 12:16:55</date.timestamp>

2005-10-12 12:16:55.0

<date.timestamp>12-10-2005 12:16:55</date.timestamp>

2005-10-12 12:16:55.0

date.mdy java.sql.Date

<date.mdy><<number>10</number><number>12</number><number>2006</number></date.mdy/>

2006-10-12

date.today java.sql.Date

<date.today />

2006-06-30

date.current java.sql.Timestamp

<date.current />

2006-06-30 13:04:55.343

XSQL-Script follows the same agreement for the date and time formats which can be founded in the java.text.SimpleDateFormat type. The date and time formats can use a format to be built or converted. With this formats, the characters of 'A' to 'Z' and of 'a' to 'z' are interpreted as representations of components of the time in a date or time string.

The patterns of date and time in the format attribute.
Letter Date and time component Presentation Examples
G Era designador Text AD
yyyy; yy Year Year 1996; 96
M; MMM; MM Month of the year Month July; Jul; 07
w Week of the year Number 27
W Week of the month Number 2
D Day of the year Number 189
d; dd Day of the month Number 8; 08
F Day of the week in a month Number 2
E Day of the week Text Tuesday; Tue
a Marker AM/PM Text PM
H; HH Time of day (0-23) Number 0; 00
k Time of day (1-24) Number 24
K Time in AM/PM (0-11) Number 0
h Time in AM/PM (1-12) Number 12
m Minute of the hour Number 30
s Second of the minute Number 55
S Millisecond Number 978
z Time zone General Time Zone Pacific Standard Time; PST; GMT-08:00
Z Time zone Time zone RFC 822 -0800