Date and hour
The Date, Time and DateTime types
Here are the available methods:
Method
|
Meaning
|
Valid for types
|
seconds
|
decimal number of seconds
|
DateTime and Time
|
days
|
whole number of days
|
Dated
|
dated
|
corresponding date
|
DateTime
|
time
|
corresponding time
|
DateTime
|
year
|
year
|
Date and DateTime
|
month
|
month
|
Date and DateTime
|
day
|
day
|
Date and DateTime
|
hour
|
hour
|
Time and DateTime
|
minute
|
minute
|
Time and DateTime
|
second
|
second
|
Time and DateTime
|
day_of_week
|
day number 0 corresponds to Sunday 6 corresponds to Saturday
|
Date and DateTime
|
Example:
var Date d
var Int i
...
i := d days
Another example:
var DateTime dt
var Int i
...
i := dt:date days # on aurait pu aussi écrire dt:date:days, mais pas dt date days
the simpler version of the previous example would be:
var DateTime dt
var Int i
...
var Date d := dt date
i := d days
We can also build a date:
var Int annee mois jour
...
var Date d := date annee mois jour
Or build a date and time:
var Int annee mois jour heure minute seconde
var Float faction_de_seconde
...
var DateTime dt := datetime annee mois jour heure minute seconde fraction_de_seconde
Current date and time
The 'datetime' function returns the current date and time:
var DateTime dt := datetime
For today's date, we therefore use:
var Date d := datetime date