For Programmers: Free Programming Magazines  


Home > Archive > ASP > July 2004 > ASP Date/Time Variables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ASP Date/Time Variables
dmiller23462

2004-07-28, 3:55 pm

Hey guys,

I'm back again....

I'm trying to put together a search page but what I'm trying to pull
off is only showing the past w's entries....

I've tried declaring "pastw" as a variable that is actually the
Now() variable....I can't seem to find any syntax help....Basically I
was thinking something along the lines of Now() - 7 days or Now() - 1
w....however I can do that....

I also tried DateAdd("d", -7, pastw) but I'm not completely sure
how to put that into the SQL statement without returning any
errors....I am missing an operator somewhere in the statement and I'm
getting a bit flustered....I asked our resident SQL statement expert
and he even tried a few things to no avail....

Let me know what YOU would do in the situation...

snippet of my SQL statement follows;
SQLqry = "SELECT * FROM shortage where date <= " & pastw
Jeff Cochran

2004-07-28, 3:55 pm

On 28 Jul 2004 05:19:30 -0700, dmiller23462@yahoo.com (dmiller23462)
wrote:

>I'm trying to put together a search page but what I'm trying to pull
>off is only showing the past w's entries....
>
>I've tried declaring "pastw" as a variable that is actually the
>Now() variable....I can't seem to find any syntax help....Basically I
>was thinking something along the lines of Now() - 7 days or Now() - 1
>w....however I can do that....
>
>I also tried DateAdd("d", -7, pastw) but I'm not completely sure
>how to put that into the SQL statement without returning any
>errors....I am missing an operator somewhere in the statement and I'm
>getting a bit flustered....I asked our resident SQL statement expert
>and he even tried a few things to no avail....
>
>Let me know what YOU would do in the situation...
>
>snippet of my SQL statement follows;
>SQLqry = "SELECT * FROM shortage where date <= " & pastw


Might start with:

Could I get a little help with dates?
http://www.aspfaq.com/show.asp?id=2040

Jeff
dmiller23462

2004-07-28, 3:55 pm

I got it working....The correct syntax that has worked for me is as follows;

**start snippet**
SQLqry = "SELECT * FROM shortage WHERE date >= " & "DateAdd('d', -7, Now())"
**stop snippet**

jeff.nospam@zina.com (Jeff Cochran) wrote in message news:<4108b511.618034266@msnews.microsoft.com>...
> On 28 Jul 2004 05:19:30 -0700, dmiller23462@yahoo.com (dmiller23462)
> wrote:
>
>
> Might start with:
>
> Could I get a little help with dates?
> http://www.aspfaq.com/show.asp?id=2040
>
> Jeff

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com