Jump to content

  • Free consultations and support
  • Live chatClick Here for Live Chat
  • Call ico 1888-906-1888
    Phone support: Open

    Ready for your call :)

    Our business hours:

    Mon — Fri, 2am — 8pm (EST)

    US & EU support teams

    Phone support: Closed

    We are back in: 1h 20m

    Our business hours:

    Mon — Fri, 2am — 8pm (EST)

    US & EU support teams


Creating Date Object in JavaScript

date object javascript

  • Please log in to reply
 

#1 DesGuru

DesGuru

    Senior Member

  • Designer
  • 220 posts

Posted 31 October 2012 - 01:33 PM

We can create Date objects using the Date() constructor.
Different ways of initiating dates:
For current date and time: new Date()
For milliseconds: new Date(milliseconds)
For Date : new Date(dateString)

For Year, month, day, hours, minutes, seconds, milliseconds): new Date(year, month, day, hours, minutes, seconds, milliseconds)
If you don’t specify a parameter 0 to be passed in. Dates are calculated in milliseconds as of 01 January,1970 00:00:00 UTC
Examples of dates:
var tod = new Date()
var d1 = new Date(89,4,21)
var d2 = new Date(89,4,21,12,30,0)





Also tagged with one or more of these keywords: date object, javascript

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users