start date/time, end date/time problem 
Author Message
 start date/time, end date/time problem

Have, I hope, a quick question.

I need to display something between a start date and time, and an end date
and time. In other words:

    strStartDate =  CDate("12/16/01 15:00")
    strEndDate =  CDate("12/16/01 23:30")

    If (Now() >= strStartDate) AND (Now() <= strEndDate) Then
         Response.Write "display a graphic"
    End If

I can't seem to make this work. I don't think it's possible to do this with
both a date and time the way I have it here, but I've done a bunch of
searching and can't find anything about doing something in between two dates
and times.

Datediff doesn't handle time. Seems like the date and times need to be
converted to something else first. Don't know.

If you respond to me directly, please remove the word REMOVE from my email
address.

Thanks!
Doug



Fri, 04 Jun 2004 13:03:04 GMT  
 start date/time, end date/time problem
I think you need to use:

strStartDate = #12/16/01 15:00#
strEndDate = #12/16/01 23:30#

Richard

Quote:
>-----Original Message-----
>Have, I hope, a quick question.

>I need to display something between a start date and

time, and an end date
Quote:
>and time. In other words:

>    strStartDate =  CDate("12/16/01 15:00")
>    strEndDate =  CDate("12/16/01 23:30")

>    If (Now() >= strStartDate) AND (Now() <= strEndDate)
Then
>         Response.Write "display a graphic"
>    End If

>I can't seem to make this work. I don't think it's

possible to do this with
Quote:
>both a date and time the way I have it here, but I've
done a bunch of
>searching and can't find anything about doing something

in between two dates
Quote:
>and times.

>Datediff doesn't handle time. Seems like the date and
times need to be
>converted to something else first. Don't know.

>If you respond to me directly, please remove the word

REMOVE from my email
Quote:
>address.

>Thanks!
>Doug

>.



Fri, 04 Jun 2004 14:12:12 GMT  
 start date/time, end date/time problem
Thanks Richard! This worked fine.

Doug


Quote:
> I think you need to use:

> strStartDate = #12/16/01 15:00#
> strEndDate = #12/16/01 23:30#

> Richard

> >-----Original Message-----
> >Have, I hope, a quick question.

> >I need to display something between a start date and
> time, and an end date
> >and time. In other words:

> >    strStartDate =  CDate("12/16/01 15:00")
> >    strEndDate =  CDate("12/16/01 23:30")

> >    If (Now() >= strStartDate) AND (Now() <= strEndDate)
> Then
> >         Response.Write "display a graphic"
> >    End If

> >I can't seem to make this work. I don't think it's
> possible to do this with
> >both a date and time the way I have it here, but I've
> done a bunch of
> >searching and can't find anything about doing something
> in between two dates
> >and times.

> >Datediff doesn't handle time. Seems like the date and
> times need to be
> >converted to something else first. Don't know.

> >If you respond to me directly, please remove the word
> REMOVE from my email
> >address.

> >Thanks!
> >Doug

> >.



Sat, 05 Jun 2004 08:10:36 GMT  
 start date/time, end date/time problem
<%
strStartDate =  CDate("12/18/01 13:00")
strEndDate =  CDate("12/18/01 23:30")
If (Now() >= strStartDate) AND (Now() <= strEndDate) Then
  Response.Write "display a graphic"
End If
%>
works on my side. Please just test this simple code, will that work? You
can also write out Now and other variables, just use one condition and so
on to troubleshoot the problem.

Hope it helps.

Regards,
Robin

This posting is provided AS IS, with no warranties, and confers no rights.



Sat, 05 Jun 2004 13:59:10 GMT  
 start date/time, end date/time problem

<%
strStartDate =  CDate("12/18/01 13:00")
strEndDate =  CDate("12/18/01 23:30")
If (Now() >= strStartDate) AND (Now() <= strEndDate) Then
  Response.Write "display a graphic"
End If
%>
works on my side. Please just test this simple code, will that work? You
can also write out Now and other variables, just use one condition and so
on to troubleshoot the problem. For example maybe the timer on the web
server is incorrect and so on.

Hope it helps.

Regards,
Robin

This posting is provided AS IS, with no warranties, and confers no rights.



Sat, 05 Jun 2004 14:00:08 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Compare date in form with date/time in form with date/time in database

2. Matching system date/time with field date/time

3. combining a time and a date to one Date/Time value

4. How to subtract a date-time from a date-time

5. ADO with Access Date/Time field not storing the time, just the date

6. Converting %date% %time% to VB Time/Date

7. Start Time must be before End Time

8. Finding the date(s) datapoints between a given start and end date, while excluding weekends

9. Multiple Dates by choosing Start and End Date

10. Problem Using Time Part of a Date-Time field in SQL-Server

11. Calculating elapsed time from date/time began from Date/time ended. Many THANKS!

12. REQ help: Calculating elapsed time from date/time began from Date/time ended. Many THANKS!

 

 
Powered by phpBB® Forum Software