Trivial facts about Javascript date

Fact 1:

Integer value representing the month, beginning with 0 for January to 11 for December. For example,

Today is

var date = new Date(2016, 3, 29, 11, 10, 30)

instead of

var date = new Date(2016, 4, 29, 11, 10, 30)

Fact 2:

The JavaScript date is based on a time value that is milliseconds, while UNIX timestamp is in second since 00:00:00 UTC on January 1, 1970.

For example, to convert a unix time:

var date = new Date(UNIX_Timestamp * 1000);

By Victor Leung

Experience in software development, consulting services and technical product management. Understanding of business and technology with an MBA in Finance and a Master degree in Computer Science. AWS Certified Solution Architect with experience in building products from scratch and serving as a charismatic leader.

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.