DATE OBJECT
In this tutorial I will show you how to properly use the Date Object.
The Date object is used to get the date with year, months, hours, minutes etc.
You can either set it to GMT (Greenwich Mean Time, or in script called UTC) or set it from the date from your operating system.
The simpliest code for getting the date is
new Date();
Which, for example, could show up as (if in a textbox):
Fri Jan 20 19:28:43 GMT+0100 2006
Below is the order of the parameters in the Date object so you can set them as you like later:
year, month, date, hour, minute, second, millisecond
So if you want a Date object to show the current date as year 1954 and month 5 you'll have to write this:
date = new Date (54, 5);
Remember, if you'll change the year the values 0-99 will show as 1900-1999 otherwise you'll have to write the full, four-digits, code.
And for the months, values are 0-11 and not 1-12. And the hours start at 0-23.
For a simple digital clock you can use this and have a dynamic text box called my_TextField
(See a bigger list below)
my_Date = new Date();
my_TextField = (my_Date.getHours() + ":" + my_Date.getMinutes() + ":" + my_Date.getSeconds());
THE DATE OBJECT GET LIST
getHours()
Used to get the current hours according to the operator.
getUTCHours()
Used to get the current hours according to the GMT time.
getMinutes()
Used to get the current minutes according to the operator.
getUTCMinutes()
Used to get the current minutes according to the GMT time.
getSeconds()
Used to get the current seconds according to the operator.
getUTCSeconds()
Used to get the current seconds according to the GMT time.
getMilliseconds()
Used to get the current milliseconds according to the operator.
getUTCMilliseconds()
Used to get the current milliseconds according to the GMT time.
getFullYear()
Used to get the current year according to the operator.
getUTCFullYear()
Used to get the current year according to the GMT time.
getMonth()
Used to get the current month according to the operator.
getUTCMonth()
Used to get the current month according to the GMT time.
getDate()
Used to get the current date according to the operator.
getUTCDate()
Used to get the current date according to the GMT time.
I think this is everything you need to know, if it's anymore that is missing please tell me.
Oh, and if you want a regular clock instead of a digital I showed above see this tutorial by Glaiel_Gamer:
AS:Clock by Glaiel_Gamer
If there's something you don't understand feel free to ask :)
Thanks for me,
-Snail-
