Print Page | Close Window

Date to Database file Mess up !!! HELP!

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=8591
Printed Date: 30 March 2026 at 7:27am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Date to Database file Mess up !!! HELP!
Posted By: BoLt
Subject: Date to Database file Mess up !!! HELP!
Date Posted: 05 January 2004 at 4:40pm

I don’t know if you can help me on this one.

I am saving a date to a database file, Month/Day/Year TIME Eg, 06/03/04 01:05:00 . If I save to a database file in the range of 1 to 12 Day's the Day and Month reverses. This is ok for the range 13 to 31 days. 

Eg, Date and time of 06/03/04 01:05:00 Reverses round to be 03/06/04 01:05:00

Is this something to do with the way the host server see’s the date and saves it to the file

If so how can I stop it?

Or

Is this somthig else?        



-------------
BoLt (Computer Engineer)
I suffer from Dyslexia, it means I can not spell to well not that I am thick.

www.welshlens.co.uk



Replies:
Posted By: zaboss
Date Posted: 06 January 2004 at 12:41am

I'm afraid that Access and SQL server sometimes get confused by dates... I don't know for sure where they loose it, but the best thing is to create a function and insert dates in a safely way, like


  <% safedate =  DatePart("yyyy", Date) &"-"& DatePart("m", Date) &"-"&DatePart("d", Date)  %>

or sothing similar and pull the dates out the same way...



-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web


Posted By: Phat
Date Posted: 06 January 2004 at 1:03am
sql always uses US dates from what i know.


Posted By: BoLt
Date Posted: 06 January 2004 at 5:52am

Thakz for your help I will give it a go.



-------------
BoLt (Computer Engineer)
I suffer from Dyslexia, it means I can not spell to well not that I am thick.

www.welshlens.co.uk


Posted By: psycotik
Date Posted: 08 January 2004 at 12:25am

Always when you use dates put it in yyyy-mm-dd format. In asp and sql. That way there is never any doubt as to which format its in.

Sometimes you might change webhosts and have to recode alot of files just to fix it, so its better to be safe from the start.



Posted By: BoLt
Date Posted: 08 January 2004 at 3:19pm
Originally posted by psycotik psycotik wrote:

Always when you use dates put it in yyyy-mm-dd format. In asp and sql. That way there is never any doubt as to which format its in.

Sometimes you might change webhosts and have to recode alot of files just to fix it, so its better to be safe from the start.

I had a feeling it had to be done in a strange format to stop the host from swopping the info around Thankz. I have got round the problem for now as I don’t wish to change all the code around by telling it to swop the data entered between 1 & 12 with the month and day. That has don the trick for now but next time I will do the format as you have described Thank you.



-------------
BoLt (Computer Engineer)
I suffer from Dyslexia, it means I can not spell to well not that I am thick.

www.welshlens.co.uk


Posted By: theSCIENTIST
Date Posted: 09 January 2004 at 3:10pm
Alternatevly you could do it my way, stop worring about which date/time format the DB holds it, and sort it by the time you call your data, ie. myDate = Year(strYear) & "/" & Month(strMonth) and so on. This way you can display date/time in the format you want.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net