|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
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:
|
|
#4
|
||||
|
||||
|
You can just display it as a string.
|
|
#5
|
|||
|
|||
|
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:
|
|
#6
|
||||
|
||||
|
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. |
|
#7
|
|||
|
|||
|
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:
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Access/ASP Changing Date Format |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|