Wednesday, July 15, 2009

Builtin JavaScript Date and Time Functions

Please visit my new Web Site

Javascript provide us a lot of Date & Time function to resolve our daily problems. In this post i will try to introduce each builtin Date & Time function with proper explanation & example. Most of the times also i can not remember all functions. So i think the below list will surely help all javascript developers. The List of builtin javascript Date & Time Function is given below:

List of builtin javascript Date & Time Function:
Function NameDescriptionOutput Range
getDate()Day of the month1 to 31
getDay()Day of the week0 to 6
getFullYear()Full 4 digit year>1999
getHours()Hour of the day0 to 23
getMilliseconds()Count from last second0 to 999
getMinutes()Count from last hour0 to 59
getMonth()No of month0 to 11. Note that 0 represent January
getSeconds()Count from last minute0 to 59
getTime()Number of milliseconds since January 01, 1970N/A
getTimezoneOffset()Difference between local time and GMT in minutes0-1439
getYear()Return Year0 to 99 for 1900 to 1999 & 4 digit from >1999
setDate()Set date1-31
setFullYear()Set full year to a date4 digit year
setHours()Set hour to a date0-23
setMilliseconds()Set milliseconds to a dateNumeric only
setMinutes()Set minute to a date0 to 59
setMonth()Set month to a date0 to 11
setSeconds()Set seconds to a date0 to 59
setYear()Set year to a dateEither 2 digit or 4 digit
toGMTString()String: GMT date and timeday dd mmm yyyy hh:mm:ss GMT
toLocaleString()toString()String: Local date & timeDepends on Operating System(OS) & Browser
valueOf()Number of milliseconds since January 01, 1970ms

For Example GO:
Format Current Date and Time
Cross-browser javascript Date diffenerence


Want to say something?

Want To Search More?
Google Search on Internet
Subscribe RSS Subscribe RSS
Article Categories
  • Gridview
  • Javascript
  • AJAX
  • Sql server
  • XML
  • CSS
  • Free Web Site Templates
  • Free Desktop Wallpapers
  • TopOfBlogs
    Free ASP.NET articles,C#.NET,VB.NET tutorials and Examples,Ajax,SQL Server,Javascript,Jquery,XML,GridView Articles and code examples -- by Shawpnendu Bikash