469,272 Members | 1,560 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,272 developers. It's quick & easy.

Javascript Max Date

Hello

I was wondering if there was a function that I could use that would select the maximum date out of an array of date entries. Could you use the javascript Math.max function and put in a date instead of a number? Just wondering
Aug 4 '08 #1
8 7920
hsriat
1,654 Expert 1GB
You can use Math.max after converting the date to YYYYMMDD format.
Aug 4 '08 #2
acoder
16,027 Expert Mod 8TB
You could also just use the getTime() method to get a number representation of the Date object.
Aug 4 '08 #3
You could also just use the getTime() method to get a number representation of the Date object.
do you think you could give me a sample of what the function would look like?
Aug 4 '08 #4
acoder
16,027 Expert Mod 8TB
Can you show what your array looks like?
Aug 4 '08 #5
Can you show what your array looks like?
i dont know what that is
Aug 5 '08 #6
acoder
16,027 Expert Mod 8TB
To quote you from the first post in this thread:
I was wondering if there was a function that I could use that would select the maximum date out of an array of date entries...
That's the array I'm talking about. Is it an array of Date objects or an array of strings representing dates?
Aug 5 '08 #7
It is an array of strings representing dates
Aug 5 '08 #8
acoder
16,027 Expert Mod 8TB
So can you give some examples? What format are they in?

You can either use the method suggested by hsriat in post #2, convert the strings into Date objects and use getTime() or just compare them using < or >.
Aug 5 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by ME | last post: by
13 posts views Thread by Hussein Patwa | last post: by
1 post views Thread by maflatoun | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.