UK Date insert

Results 1 to 2 of 2

Thread: UK Date insert

  1. #1
    Join Date
    Dec 1969

    Default UK Date insert

    Hi,<BR>I have asked this question before and have read all I can about fixing this problem but am no closer.<BR>I have a UK site hosted on a US server. My Access DB is set to UK date format. My ASP page LCID is set to UK. <BR>I have a form on the page which needs a (dd/mm/yyyy) date inserted from a user field. No mater how i try to insert the page the date keeps getting changed around to US format unless the dd feild is above 12 (for obvious reasons) and then works fine.<BR>I have had this problem before with a hidden field and got addound it by splitting up the date &#039;parts&#039; so that it is inserted the way i want. <BR>I dont know how i can do this with a user field though.<BR>Can anyone help??<BR>Thanks<BR>Ronan

  2. #2
    Join Date
    Dec 1969

    Default Not with Access via SQL

    Access SQL *ONLY* understands USA (mm/dd/yyyy) and ISO (yyyy-mm-dd) formats.<BR><BR>SO:<BR><BR>&#060;%<BR>Function ISODate( dt )<BR> If IsDate( dt ) Then<BR> dt = CDate(dt) &#039; just for safety<BR> ISODate = "#" & Year(dt) & "-" & Month(dt) & "-" & Day(dt) & "#"<BR> Else<BR> ISODate = "NULL"<BR> End If<BR>End Function<BR>%&#062;<BR><BR>And then build your SQL via something like:<BR><BR>SQL = "INSERT INTO table ( when ) VALUES( " & ISODate(someDate) & ")"<BR><BR>Notice that ISODate adds the #...# for you, so don&#039;t do it again.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts