Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Date to Database file Mess up !!! HELP!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Date to Database file Mess up !!! HELP!

 Post Reply Post Reply
Author
BoLt View Drop Down
Senior Member
Senior Member


Joined: 20 November 2003
Location: United Kingdom
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote BoLt Quote  Post ReplyReply Direct Link To This Post Topic: Date to Database file Mess up !!! HELP!
    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
Back to Top
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post 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
Soft 4 web
Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post Posted: 06 January 2004 at 1:03am
sql always uses US dates from what i know.
Back to Top
BoLt View Drop Down
Senior Member
Senior Member


Joined: 20 November 2003
Location: United Kingdom
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote BoLt Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
psycotik View Drop Down
Groupie
Groupie


Joined: 27 November 2003
Status: Offline
Points: 73
Post Options Post Options   Thanks (0) Thanks(0)   Quote psycotik Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
BoLt View Drop Down
Senior Member
Senior Member


Joined: 20 November 2003
Location: United Kingdom
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote BoLt Quote  Post ReplyReply Direct Link To This Post 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.



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

www.welshlens.co.uk
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.