Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 18th, 2004, 08:34 AM
Authorized User
 
Join Date: Nov 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default dates in iis

hi all,
hope you can help. I have an ms access database, in the database is a table which contains a date. I have an asp page which takes each date (select distinct) nd places these dates into a select drop don wn box. In the database the dates are displayed in the formay dd/mm/yyyy. When the asp script runs the date in the drop down list is displayed as dd/mm/yy. Ive checked the locale settings and these seems fine. Anyway in the next page im using a search between sql statement to search the records by date, however this produces no records. I think this is because of the above problem with the date format. Is this correct, and if it is anyone know how i can solve it.

Many thanks

 
Old August 18th, 2004, 08:56 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Hello Paul,
I had this type of problems for a long time. Now I have solved it fully using the following method.

When inserting date into access database, I make it into a string of the format
MM/DD/YYYY and put it in between # and #.
i.e. Use the query

"INSERT INTO <table> (datefield) VALUES(#" & <monthcombovalue> & "/" & <datecombovalue> & "/" & <yearcombovalue> & "#)"

While fetching the result from database, I am doing it in following way.

datevalue=day(rs("datefield"))
monthvalue=month(rs("datefield"))
yearvalue=year(rs("datefield"))

While searching, in the select query I am putting it like this.

"SELECT * FROM <table> WHERE datefield BETWEEN #" & <monthcombovalue1> & "/" & <datecombovalue1> & "/" & <yearcombovalue1> & "# AND #" & <monthcombovalue2> & "/" & <datecombovalue2> & "/" & <yearcombovalue2> & "#)"



This will work independent of the locale setting at server.

Please try this and let me know.

Also, may I know whether there are any potential problems for this method ? (AFAIK, I could not find anything.)

BTW, date format should be shortdate in access table.
 
Old August 19th, 2004, 01:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Paul,

Also remember that you got to avoid # around date values for searching in the database, if you are not using access.

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
iis.msc equivalent in IIS for Win XP Pro? RealDHelix Classic ASP Basics 14 March 18th, 2007 08:28 PM
dates DARSIN General .NET 4 January 14th, 2005 09:09 AM
between dates capitala Access VBA 1 May 30th, 2004 05:20 PM
CreateObject error on IIS 4 but not IIS 5 timtom Classic ASP XML 1 December 5th, 2003 01:26 PM
Dates oathamm Servlets 1 June 27th, 2003 05:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.