Ask a Question related to ASP, Design and Development.
-
Bob the ASP Builder #1
Access SQL- Date comparison problem
I use an Access-database where one column stores a date originating from
this code:
Indate = FormatDateTime(date(),vbgeneraldate)
I then want to be able to show postings from the database being i.e.
smaller than current date.
So I use the current date from a code same as the above code and want to
compare with dates in the database.
The column in the database is in Date/time format and a posting from
today will read 2004-01-31
In my process page code I do this
Dim Tday
Tday = FormatDateTime(date(),vbgeneraldate)
SQL = "SELECT * FROM Ads WHERE Indate<" & Tday & " ORDER BY ID"
Resulting in no postings found
Whereas this
SQL = "SELECT * FROM Ads WHERE Indate>" & Tday & " ORDER BY ID"
returns every post in the database whether larger or smaller doesnt
matter
It seems the data reading is interpreted differently to how it presents
itself.
How can I set the SQL-statement to compare the dates correctly?
Bob the ASP Builder
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Bob the ASP Builder Guest
-
Date comparison in a text data field
I have a database column field defined as a text. I store dates in format: dd/mm/yyyy. The user passes a Start date search string in the same... -
Date comparison failure
Does this qualify as an advanced technique? Sorry if not. This is a section of stock control I am doing to track supplier orders. I have a two... -
PhP, Access/SQL, Data comparison problem. (I'm new to PhP)
Hi All! I'm fairly new to PhP and basicly trying to learn right now. Now I have a problem - I have a fairly large collection of movies which people... -
Date comparison and file download
My goal, I would like to Compare the date of a file (one on the local drive, one on a remote server/url), if a newer resides on the server/url, then... -
Date comparison :: Original price vs Reduced price :: Access 2000/ASP
I need some guidance in how to control dates with regards price reductions in my product list inside an Access 2000 database. For instance: 1.... -
Bob Barrows #2
Re: Access SQL- Date comparison problem
Bob the ASP Builder wrote:
Totally unnecessary, but carry on.> I use an Access-database where one column stores a date originating
> from this code:
>
> Indate = FormatDateTime(date(),vbgeneraldate)
You do realize that this has nothing to do with how the datetime value is>
> I then want to be able to show postings from the database being i.e.
> smaller than current date.
> So I use the current date from a code same as the above code and want
> to compare with dates in the database.
> The column in the database is in Date/time format and a posting from
> today will read 2004-01-31
stored ... or do you?
Date/times in Access are stored as Double numbers, with the whole number
portion representing the number of days since the seed date, and the decimal
portion representing the time of day (.0 = midnight, .5 = noon)
Jet requires that date literals be delimited by hash marks (#):>
> In my process page code I do this
>
> Dim Tday
>
> Tday = FormatDateTime(date(),vbgeneraldate)
>
> SQL = "SELECT * FROM Ads WHERE Indate<" & Tday & " ORDER BY ID"
>
SQL = "SELECT * FROM Ads WHERE Indate>#" & Tday & "# ORDER BY ID"
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
Bob the ASP Builder #3
Re: Access SQL- Date comparison problem
THANKS HEAPS!!
Yes I realised the difference in stored value and presented value - but
my tutorial was too incomplete to teach me the #-keys - IT ALL WORKS now
- thank You
Bob the ASP Builder
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Bob the ASP Builder Guest



Reply With Quote

