X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=blobdiff_plain;f=scilab%2Fmodules%2Ftime%2Fhelp%2Fen_US%2Fgetdate.xml;h=4f140a4628b9b0361e2dbf3550335f67dd52e831;hp=8dade9cb69976be6903926a055240764597f45db;hb=8ae0aa85f1e42ca3f80947a1e965c366c199cf7d;hpb=1b57296990c158949637b416d99f4cbfbebecafe diff --git a/scilab/modules/time/help/en_US/getdate.xml b/scilab/modules/time/help/en_US/getdate.xml index 8dade9c..4f140a4 100644 --- a/scilab/modules/time/help/en_US/getdate.xml +++ b/scilab/modules/time/help/en_US/getdate.xml @@ -1,9 +1,7 @@ - + getdate - get date and time information + + Current datetime or POSIX timestamp from computer's clock. Datetimes from given timestamps + Syntax - dt=getdate() - x=getdate("s") - dt=getdate(x) + + curDatetime = getdate() + timeStamp = getdate("s") + dateTimes = getdate(timeStamps) Arguments - dt + curDatetime - an integer vector with 10 entries (see below) + vector of integers with + + + + + + + + + + + + + +
1 2 3 4 5 6 7 8 9 10 year Index Content Range â¥Â 1970 [1,12] [1,53] [1,366] [1,7] 1=sunday [1,31] [0,23] [0,59] [0,59] [0,999]
+
- x - - an integer containing a date coded in second from 1 Jan 1970 - - -
-
- - Description - - - dt=getdate() + timeStamp - returns the current date in format given below: - - - dt(1) - - The year as a number (with the century) between 0000 and 9999. - - - - dt(2) - - The month of the year as a number between 01 and 12. - - - - dt(3) - - The ISO 8601 week number as a number between 01 and 53. - - - - dt(4) - - The Julian day of the year as a number between 001 and 366. - - - - dt(5) - - Specifies the weekday as a decimal number [1,7], with 1 representing Sunday. - - - - dt(6) - - The day of the month as a number between 01 and 31. - - - - dt(7) - - The hour of the day is output as a number between 00 and 23. - - - - dt(8) - - The minute is output as a number between 00 and 59. - - - - dt(9) - - The second is output as a number between 00 and 59. - - - - dt(10) - - The millisecond is output as a number between 000 and 999. - - - + integer number of seconds elapsed since 1970-01-01Â 00:00:00Â UTC, + excluding leap seconds, as defined by the POSIX standard (see description). + - x=getdate("s") + timeStamps - returns a scalar with the number of seconds since Jan 1, 1970, 00:00 UTC (Unix Time Convention) - - Please note that the return value contains the leap seconds. - + Array of positive decimal numbers representing POSIX timestamps. + Negative timestamps are not accepted. + - dt=getdate(x) + dateTimes - formats the date given by x (number of seconds since Jan 1, 1970, 00:00 UTC) in format given above. - In this case dt(10) is always equal to 0. - - - getdate(0) will return Jan 1, 1970, 00:00 if the time zone concerned is UTC, but if the time zone is UTC+1, hour - returned will be 01:00. - + length(timeStamps)-by-10 Matrix: The row #i elements are datetime data + corresponding to timeStamps(i), as documented for curDatetime, + except that dateTimes(:,10) are fractions of second in [0,1) + instead of milliseconds. dateTimes are expressed in the current computer's time + zone. + + Description + + getdate() returns the current datetime of the + computer's clock, expressed in the Gregorian calendar, and for the computer's + time zone + possible daylight saving offset. + + + Nowadays, most of computers are automatically synchronized with the legal time + for the considered time zone, through time servers. Legal datetimes are + synchronized on the Coordinated Universal Time (UTC), by a known time zone + (and daylight saving) offset. + + + getdate("s") reads the computer's clock + and returns the corresponding POSIX timestamp. This corresponds to the number + of seconds elapsed since 1970-01-01Â 00:00:00Â UTC, except that leap seconds + are not counted. Hence, if n = getdate("s") is run at an + exact round hour, modulo(n, 3600) will return 0 instead + of cumulated leap seconds + added since 1972 (27s, up to 2020). + + + getdate(timeStamps) returns the status of the + local computer's clock for the given POSIX time stamps, that may include fractional + seconds. If any, the computer's current Daylight Saving offset is never considered. + getdate(0) will return 1970-01-01Â 00:00:00 + only if the clock is set for the time zone = 0. Otherwise, for instance for + Scilab users living in BÃ©lem, Brazil, UTC-3, getdate(0) returns + 1969-12-31Â 21:00:00, actually corresponding to 1970-01-01Â 00:00:00 POSIX. + + + Examples + D = getdate() + D = + 2020. 7. 30. 208. 1. 26. 23. 8. 28. 474. + +--> mprintf("%d-%02d-%02d %02d:%02d:%06.3f\n", D(1), D(2), D(6:8), D(9)+D(10)/1000); +2020-07-26 23:08:28.474 + +--> x = getdate("s"); +--> mprintf("%.2f\n", x) +1595797708.00 + +--> D = getdate(0) + D = + 1970. 1. 1. 1. 5. 1. 1. 0. 0. 0. + +--> mprintf("%d-%02d-%02d %02d:%02d:%06.3f\n", D(1), D(2), D(6:8), D(9)+D(10)/1000); +1970-01-01 01:00:00.000 +]]> + + getdate("s") ignores leap seconds: + + 0 + D = getdate(); + x = getdate("s"); + s = D(9); + sleep(300) // ms. To not use 100% of your processor +end +// If leap seconds are taken into account, they would appear here (27, in 2020): +modulo(x, 60) + ]]> + modulo(x, 60) + ans = + 0. +]]> + + + getdate([1e9, 2e9, 3e9] + 0.21) + ans = + 2001. 9. 36. 252. 1. 9. 3. 46. 40. 0.21 + 2033. 5. 20. 138. 4. 18. 5. 33. 20. 0.21 + 2065. 1. 4. 24. 7. 24. 6. 20. 0. 0.21 +]]> See also + calendar + + date + clock + + timer + + datenum +