Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to count number of weeks betwee

Status
Not open for further replies.

vovan1415

Programmer
Dec 6, 2001
50
0
0
US
How to count number of weeks between to dates
if i have them as string values
for example :'03/03/2003' and '09/09/2003'
 
date1 = new Date('03/03/2003')
date2 = new Date('09/09/2003')

numMilliSecs = Date.parse(date2) - Date.parse(date1)

milliSecsPerWeek = 1000 * 60 * 60 * 24 * 7

numWeeks = Math.floor(numMilliSecs / milliSecsPerWeek) Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top