navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

displaying days between a date range

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> displaying days between a date range
Page: [1]
 
sentinel

 

Posts: 566
Joined: 5/4/2005
From: Chicago, Illinois
Status: offline

 
displaying days between a date range - 2/28/2008 14:51:21   
Hey all,

I am creating a page that tracks vacation days. I have a form with 5 date fields on it. the first two are for choosing a beginning date and end date ( this is in case you take say 5 vacation days in a row).

The last 3 are for choosing any days that do not fall into the date range ( if chosen )

What I need to do somehow be able to present the user with all all the days they took off in a month. It is easy to create a results page showing the individual dates. How do I display the individual dates in the date range? Example... I need to show all days from 2008-01-01 to 2008-01-07.

2008-01-01
2008-01-02
2008-01-03
2008-01-04
2008-01-05
2008-01-06
2008-01-07

Any ideas?

< Message edited by sentinel -- 2/28/2008 15:28:55 >


_____________________________

No matter where you go, there you are.
rdouglass

 

Posts: 9186
From: Biddeford, ME USA
Status: offline

 
RE: displaying days between a date range - 2/28/2008 15:56:14   
Just a quick stab:

...
FOR i = 0 TO datediff("d",startdate,enddate)
response.write(dateadd("d",i,startdate) & "<br>")
Next
...

something in that line perhaps? You see what I'm doing? Getting the number of days and using DateAdd inside a lopp?

That help any?

Oh Yeah, you'll probably want to use FormatDateTime with that.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to sentinel)
sentinel

 

Posts: 566
Joined: 5/4/2005
From: Chicago, Illinois
Status: offline

 
RE: displaying days between a date range - 2/28/2008 16:08:20   
I did a test with
<%
startdate=2007-01-01
enddate=2007-01-01
FOR i = 0 TO datediff("d",startdate,enddate)
response.write(dateadd("d",i,startdate) & "<br>")
Next

%>

and it returned

6/27/1905

If I changed it to :
<%
startdate=2007-01-01
enddate=2007-01-09
FOR i = 0 TO datediff("d",startdate,enddate)
response.write(dateadd("d",i,startdate) & "<br>")
Next

%>

It returns a blank page.

Any ideas?



_____________________________

No matter where you go, there you are.

(in reply to rdouglass)
rdouglass

 

Posts: 9186
From: Biddeford, ME USA
Status: offline

 
RE: displaying days between a date range - 2/28/2008 16:47:20   
quote:

startdate=2007-01-01
enddate=2007-01-01


Sorry, my example would require a different date format as in:

startdate="2007-01-01"
enddate="2007-01-01 "

But those would probably not be in the proper format. Something like this might be better for your specific scenario:

startdate="2007-01-01"
enddate="2007-01-01"

startdate = cdate(mid(startdate,6,2) & "/" & right(startdate,2) & "/" & left(startdate,4))
enddate = cdate(mid(enddate,6,2) & "/" &right(enddate,2) & "/" & left(enddate,4))

Something like that to put it in a MM/DD/YYYY format. That any help?


_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to sentinel)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> displaying days between a date range
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts