| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
||||
|
||||
|
Date and Time Functions
The most commonly used methods of Date are given below. for a complete listing, refer to Netscape's JavaScript Documentation.
getYear() dateVar.getYear() returns a number like 96 corresponding to the year of dateVar. getMonth() Returns a number between 0 and 11 corresponding to months January to December. getDate() Returns the day of the month. getDay() Returns a number specifying the day of the week. Zero is for Sunday, one for Monday and so on. getHours() Returns a number between 0 and 23 specifying the hour of day. //************************************** // To make it easy to handle date and time, JavaScript has a built in Date object. A Date variable has to be created explicitly before we can use it. this can be done using the following JavaScript statement. dateVar = new Date(); this creates a variable called dateVar and initializes it to contain the curent date and time. if you want to initialize it with some other date and time, you can use any of the following alternate syntaxes. dateVar = new Date("month day, year hours:minutes:seconds") dateVar = new Date(year, month, day) dateVar = new Date(year, month, day, hours, minutes, seconds) |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Date and Time Functions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
![]() |
|