473,414 Members | 1,980 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,414 software developers and data experts.

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 8187
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

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

Similar topics

1
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...
9
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,...
13
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...
3
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...
1
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?...
4
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...
1
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 <...
3
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...
4
xstatic
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...
34
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...
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
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,...
0
jinu1996
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.