Var D New Date Year 0 1
Notice that n isn t a date object but the number of millisecond since midnight jan 1 1970.
Var d new date year 0 1. But this didn t work with firefox. To get the current date and time you can use. You can also specify an exact time following the date in the order hours minutes seconds and milliseconds.
Var eventdate new date. If you want to get the date and time in the universal timezone just replace these methods with the getutcdate getutcmonth and getutcfullyear respectivley as shown in the following example. Get the month as a number 0 11 getdate get the day as a number 1 31 gethours get the hour 0 23 getminutes get the minute 0 59 getseconds get the second 0 59 getmilliseconds get the millisecond 0 999 gettime get the time milliseconds since january 1 1970 getday get the weekday as a number 0 6 date now get the.
The getdate getmonth and getfullyear methods returns the date and time in the local timezone of the computer that the script is running on. That s fine if we want get the current date and time however it doesn t help us much if we are planning on working with a date in the past or future. Date object can be created using new keyword.
Date variable from an api all in iso 8601 format yyyy mm dd hh mm ss var date odate events event 0 start time. Get current date using date or new date. Date methods allow you to get and set the year month day hour minute second and millisecond of date objects using either local time or utc universal or gmt time.
Date can be created by specifying date string in different formats using different separators. You can create a date object for a given date using. Above answer helped me format it correctly for firefox.
Var outputdate eventdate todatestring. When a date object is created a number of methods allow you to operate on it. Var my date new date after creating an instance of the date object you can access all the methods of the object from the my date variable.