Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 9th, 2004, 06:55 AM
sleaver sleaver is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 16 sleaver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Access/ASP Changing Date Format

I am trying to insert 2 dates into an access database field which I've set to the short date format. The user inputs the first date into a text box and then is converted to a date with the CDate. The page then adds 1 day to the inputted date to get the next! The 2 dates are as follows

12/11/2003 and 13/11/2003

The SQL string inputs them in the correct dd/MM/yyyy format but when I look at the table the 12/11/2003 date comes out as 11/12/2003. The second date says correct though.

Ive tried other dates and it seems that if the day is > 12 it stays in the correct dd/MM/yyyy format, if its less than 12 it changes to MM/dd/yyyy.

I have set the culture to "EN-GB" in the machine.config and web.config file and set the session to United Kindom in the global.asax file.

Please help as ive been trying to solve this for 2 days.

Reply With Quote
  #2  
Old February 9th, 2004, 06:58 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
If you are just saving the date format (mm/dd/yyyy), then just change the data type of the field to Text (10) and write it to the database that way. Then you don't have to worry about access changing the format.
Basically, write the date to the database as a string, instead of a date.

Reply With Quote
  #3  
Old February 9th, 2004, 07:16 AM
sleaver sleaver is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 16 sleaver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks

I did think of this way but later on a want to display it in a datagrid in a date format.

Would I just simplay display it still as a string or do I need to change it to a date format?

Quote:
Originally Posted by Memnoch
If you are just saving the date format (mm/dd/yyyy), then just change the data type of the field to Text (10) and write it to the database that way. Then you don't have to worry about access changing the format.
Basically, write the date to the database as a string, instead of a date.

Reply With Quote
  #4  
Old February 9th, 2004, 09:42 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
You can just display it as a string.

Reply With Quote
  #5  
Old February 9th, 2004, 10:13 AM
sleaver sleaver is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 16 sleaver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Just remembered that I have to add to the date! For example if the dates entered are 02/02/2004 and 07/02/2004 I will keep adding 1 to the date using DateAdd. This cant be done as a string though?

Any ideas on kepping the correct format but using a Date field, not string?

Quote:
Originally Posted by Memnoch
You can just display it as a string.

Reply With Quote
  #6  
Old February 9th, 2004, 10:19 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
you can convert the string to a date, add the day to it, then convert it back to a string.

Or just grab the day value from the string and add 1 to it.

Reply With Quote
  #7  
Old February 9th, 2004, 10:52 AM
sleaver sleaver is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 16 sleaver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ive tried using a string but when I convert 13/11/2003 to a date a get the following error:

Cast from string "13/11/2003" to type 'Date' is not valid.

Its trying to flip the date and month but there aren't 13 months and so wont let me do it!

Any Ideas?????

Quote:
Originally Posted by Memnoch
you can convert the string to a date, add the day to it, then convert it back to a string.

Or just grab the day value from the string and add 1 to it.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Access/ASP Changing Date Format


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway