473,388 Members | 893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Javascript Max Date


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 8185
1,654 Expert 1GB
You can use Math.max after converting the date to YYYYMMDD format.
Aug 4 '08 #2
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
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
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
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

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

Similar topics

by: C | last post by:
Hi, I take ina series of date inputs from the user. I use below JavaScript to parse String into a Date Object and then I get the Day part and compare the day part. The date entered for...
by: ME | last post by:
can someone tell me how to make this first one work??, located here: http://javascript.about.com/library/scripts/blshowdatetime.htm#examplesource This second one, well, dreamweaver eats the code,...
by: Hussein Patwa | last post by:
Hi there. I'm new to this group. I'm also partially sighted so navigating the web is sometimes quite difficult. I'm looking for a javascript date picker, you know the ones that travel sites...
by: pmarisole | last post by:
The following javascript code gives me the date validation that I need except after the correct date is entered into the field, it puts the date in the wrong format EXAMPLE: User enters...
by: maflatoun | last post by:
Hi, I have the following Date and Time format (taken from C#. NET's DataSet and sent to clients browser using Ajax). Thu Apr 6 20:43:59 EDT 2006 What's the easiest way to parse this?...
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow...
by: viswanadhds | last post by:
Hi all, I was trying to compare a date with todays date like this var date1 = getDateObject(document.groupForm.endDate.value); var today = new Date(); today.setHours(0,0,0); if(date1 <...
by: Andy T | last post by:
Hi I am using a small java script that puts up the date in three drop down menus. The scripts works beautifully on most machines BUT will not work on my lap top. The drop down boxes are...
by: xstatic | last post by:
After searching through the hundreds of links about "Javascript Date Formatting", all I am finding is how to format dates that gives a "current date" result. Here is what I need... I have a...
by: -Lost | last post by:
I'm REALLY liking this so far. And for those who welcome something a little less cryptic than what the resident date guru offers, here's a chance to try something fairly elegant and definitely...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.