Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - date changes in database
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

date changes in database

 Post Reply Post Reply
Author
JOS121212 View Drop Down
Newbie
Newbie


Joined: 28 September 2005
Location: Netherlands
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote JOS121212 Quote  Post ReplyReply Direct Link To This Post Topic: date changes in database
    Posted: 28 September 2005 at 3:26pm
hi people

I have a website (ASP) with a secure area where users can enter information and maintain it. One page deals with new (music) releases. When I enter a date it needs to be in the format dd-mm-yyyy. In the global.asa I have entered the session.lcid=1043.
BUT: every time I enter a date in the form, like 1-9-2005, after processing the database returns 9-1-2005. I have done some tests like response.write date before entering it into the database and then the result is okay. So the reversal occurs at the moment that the date is entered into the database. However, somehow 9-1-2005 gets entered into the database.
I don't get it. And the strangest part is that when I enter a date that cannot be reversed, like 15-9-2005 the result is okay.....

Who can solve this one?
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 28 September 2005 at 6:44pm
Use setdateformat in sql server if you cannot change the global properties of SQL
 
SET DATEFORMAT dmy
GO
DECLARE @datevar datetime
SET @datevar = '1/9/05'
SELECT @datevar
GO
you can use I think dmy, mdy ymd and so on to specify what order the inputstring is....
Back to Top
JOS121212 View Drop Down
Newbie
Newbie


Joined: 28 September 2005
Location: Netherlands
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote JOS121212 Quote  Post ReplyReply Direct Link To This Post Posted: 29 September 2005 at 12:22am
Thanks Michael,
but as I said in my post, the site is an ASP site. So I don't work with php and sql but with asp and access....
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 29 September 2005 at 8:09am
Oh did not see the access part. Not sure how you set that in access
Back to Top
JOS121212 View Drop Down
Newbie
Newbie


Joined: 28 September 2005
Location: Netherlands
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote JOS121212 Quote  Post ReplyReply Direct Link To This Post Posted: 29 September 2005 at 3:10pm
okay, and thanks for your effort!
Back to Top
tskaar View Drop Down
Newbie
Newbie
Avatar

Joined: 02 July 2005
Location: Norway
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote tskaar Quote  Post ReplyReply Direct Link To This Post Posted: 03 October 2005 at 8:00am
It should work if you use the following code in Global ASA




 Sub Session_OnStart

     Session.LCID = 1043

End Sub



If not, try to put

    <% Session.LCID = 1043 %>   


in top of your ASP-pages
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 31 October 2005 at 6:06pm
you might want to check the format of the date field within access, check that it does not have a format mask, or whatever it's called. Also, check whether the change in the date happens when the date gets to access, or after it gets recalled from the database...
 
if all else fails, try running the following function on your dates before you insert them... i had an access backend for a page i was working on months ago that i had this problem with, and it fixed it...
 
 
function formatdate(thedate)
theday = datepart("d",thedate)
themonth = datepart("m",thedate)
theyear = datepart("yyyy",thedate)
thedate = themonth & "/" & theday & "/" & theyear
end function
 
don't ask me why it does it... i knew, i forgot, we moved on with our lives... LOL
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.