I am doing the following:
new Date().setFullYear(2011, 0, 1);
Does this gives me the number of seconds since January 1, 1970?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Internally, Javascript stores a date as the number of milliseconds since midnight, January 1, 1970. (Not seconds — milliseconds.) You can get this number out of the date object with the getTime function.
In practice, the “base date” rarely makes a difference. Usually you use the various Date functions to format the date in a conventional format. You occasionally get differences between two times by using getTime and subtracting one from another.