ECMAScript 5′s Date Extensions
SEO Service Company India - We provide ethical search engine optimisation services to companies world wide. Contact us to get high quality seo services at affordable prices.
One of the changes that ECMAScript 5 introduces is extensions to the
Date class. Some of these are very useful — Date.now and Date.UTC as well as ISO-8601 format support.
Michael J. Ryan has written support for these API changes in DateExtensions.js so you can get started using them now.
Internet Marketing Company
SEO Consulting - With the most effective affordable SEO packages services in New York, ELM Consulting is the leader in helping small business grow on the web. Click here to learn more about our affordable SEO packages services and much more.
redesign website
Basariyorum is a leading web solution company catering to all your
website design and development needs there by helping your business
grow.
Usage looks like this:
var epoch1 = new Date("1970-01-01T00:00:00.000Z");
var epoch2 = new Date(0);
if (epoch1.getTime() == epoch2.getTime())
alert("Epochs match!");
alert(epoch1.toString()); //localized date instance of the JS epoch
alert(epoch2.toISOString()); // "1970-01-01T00:00:00.000Z"
alert(epoch1 instanceof Date); // true
alert(Date.UTC(1970,0,1,0,0,0,0)); // 0
More on ECMAScript
Other ECMAScript 5 extensions to the base library include:bind()that works like Prototype’s bind- A JSON object that supports parsing and generation
- New object/property extensions: ECMAScript 5 Objects and Properties
- String now has a
trim()method Arraygets useful methods likefilter()andmap()