RSS

Blog

Comparing dates with JavaScript

h321 May 2009 –  Comments (6)

Comments

It's just using the millisecond representation of the Date object. You can do the same thing by using the .getTime() method - I'm not sure but I suspect that your way may not work on every browser.

[] evan ~ 10 months ago at 9:17 p.m.

You think you're excited? I only just found out reading this that I can run javascript directly in Firebug! I've never had that extra pane open before! thank you.

[] Jon ~ 10 months ago at 2:08 a.m.

very cool & good tip, thank you very much for sharing.

Can you share this snippet on my JavaScript site, http://javascriptbank.com/submit/ ?

Thank

[] TCP ~ 10 months ago at 3:44 a.m.

A Date is a timestamp (in ms), so a Number, new Date().valueOf() - no big surprise here.

v8 has some interesting usage of the modulo:

http://v8.googlecode.com/svn/trunk/src/date-delay.js

Cheers

[] Yoan ~ 10 months ago at 6:27 a.m.
[] Felix ~ 9 months, 2 weeks ago at 9:40 p.m.

Thank you for your info ,welcome to read this info: http://www.goodpuma.com

[] Puma shoes ~ 3 weeks, 1 day ago at 2:20 a.m.

Copyrighted stuff .. u know.