473,324 Members | 2,548 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,324 software developers and data experts.

ASP Date/Time Variables

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 week's entries....

I've tried declaring "pastweek" 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
week....however I can do that....

I also tried DateAdd("d", -7, pastweek) 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 <= " & pastweek
Jul 19 '05 #1
2 1433
On 28 Jul 2004 05:19:30 -0700, dm**********@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 week's entries....

I've tried declaring "pastweek" 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
week....however I can do that....

I also tried DateAdd("d", -7, pastweek) 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 <= " & pastweek


Might start with:

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

Jeff
Jul 19 '05 #2
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**

je*********@zina.com (Jeff Cochran) wrote in message news:<41****************@msnews.microsoft.com>...
On 28 Jul 2004 05:19:30 -0700, dm**********@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 week's entries....

I've tried declaring "pastweek" 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
week....however I can do that....

I also tried DateAdd("d", -7, pastweek) 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 <= " & pastweek


Might start with:

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

Jeff

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sunil Korah | last post by:
Hi, My table contains a date field "DateOfVisit" and I have the following query SELECT Patients.PID, Patients.Lastname, Patients.FirstName, Patients.DateOfVisit, Patients.ToReport FROM...
4
by: S. van Beek | last post by:
Dear reader, I often have troubles with these variables. Now() is always working but it also include the time and in some cases you don't need the time.
1
by: ESPNSTI | last post by:
Hi, I'd like to be able to distinguish between a DateTime variable that is allowed to hold both date and time and a DateTime variable that is allowed to only hold a Date. The reason's for this...
2
by: Keith | last post by:
Good Afternoon, New to .Net. I am trying to pass date/time values to a MS Access query depending on what value is selected from a dropdown list box (January, February, etc). I have declared...
18
by: dfetrow410 | last post by:
Anyone have some code that will do this? Dave
7
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in...
12
by: Rob Meade | last post by:
Hi all, Ok - I've come from a 1.1 background - and previously I've never had any problem with doing this: Response.Write (Session("MyDate").ToString("dd/MM/yyyy")) So, I might get this for...
7
by: JamesG | last post by:
Hi, I need to convert the current time to the format "hh:mm:ss" and date to the format "yyyy-MM-dd". The result of both conversions needs to be of System.DateTime format. I've tried using...
4
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I am trying to compare just the time portion of two variables that are of date time part. For example I have dtdate1= 2/2/07 10:00:00 dtdate2=3/4/07 9:00:00 so for the comparision I would...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.