DoTime

Time
Aptilis 1

DoTime(ArrayName[])

Dotime is the reverse of FillLocalTimeArray. You must first fill the array with values for year, month, day, hour, minutes, and seconds and then pass the array to doTime. doTime will then return a number of seconds elapsed since January 1st, 1970.
The values to fill are:
0: Seconds (0..59)
1: Minutes (0..59)
2: Hours (0..23, 24 hour clock = military time)
3: day in month (1..31)
4: month (0..11)
5: year (full year, ex: 1998)

No other values should be present. You can use clearArray to empty an array.

Return value:
The time, in seconds.

Example:

day[0] = "Sunday" $
day[1] = "Monday" $
day[2] = "Tuesday" $
day[3] = "Wednesday" $
day[4] = "Thursday" $
day[5] = "Friday" $
day[6] = "Saturday" $

t = gettime()
print("time: ", t, "\n")

FillTimeArray(time[], t)

print("Heure: ", int(time[2])$, ":", int(time[1])$, ":", int(time[0])$, "\n")
print("Date: ", int(time[3])$, ":", int(time[4]+1)$, ":", int(time[5])$, "\n")

print("\nDay: ", day[time[7]]$, ", year day:", int(time[6])$, "\n")
print("The reverse is: ", DoTime(time[]), "\n")
Result:
time: 853352573.000000
Heure: 18:22:53
Date: 15:1:1997

Day: Wednesday, year day:15
The reverse is: 853352573.000000
See also: getTime, fillTimeArray, fillLocalTimeArray.