OLPCities/Date: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (OLPCities/Date moved to Walter's butthole 26: Walter's butthole) |
(No difference)
| |
Revision as of 19:34, 3 December 2009
"Date" is a Class that is part of the generic JavaScript API. This "library" is referenced automaticaly by the browser of the OLPC station and you don't need to add anything in the program to use it.
To use the elements of the Class you need to write, in the program, the line of code to create an object, a prefix:
date = new Date();
Methods
Using this prefix, the methods of the Class are:
date.getDate() Returns the day of the month as an integer
date.getUTCDate() between 1 and 31, using local time or UTC.
date.getDay() Returns the day of the week as an integer
date.getUTCDay() between 0 (Sunday) and 6 (Saturday).
date.getFullYear() Returns the year as an four-digits integer.
date.getUTCFullYear()
date.getHours() Returns the hours as an integer betwenn 0 and 23
date.getUTCHours()
date.getMilliseconds() Returns the milliseconds between 0 and 999
date.getUTCMilliseconds()
date.getMinutes() Returns the minutes between 0 and 59
date.getUTCMinutes()
date.getMonth() Returns the month using 0 (January)
date.getUTCMonth() to 11 (December)
date.getSeconds() Returns the seconds between 0 and 59
date.getUTCSeconds()
date.getTime() Returns the number of milliseconds between
January 1, 1970 at 00:00:00 UTC and now .
date.TimeZoneOffset() Returns the number of minutes between
local time and UTC as an integer.
date.getYear() Returns the two-digits year.
UTC (Universally Coordinated Time) is the old GMT.