Welcome Back Mister Wilkinson

Results 1 to 2 of 2

Thread: Welcome Back Mister Wilkinson

  1. #1
    Join Date
    Dec 1969

    Default Welcome Back Mister Wilkinson

    Bill, <BR> on the SQL Server Date problem: I applied the different date functions, but none gave me the right format. what puzzled me was that the dates were displaying fine before we moved the intranet contents to the new server. Then it hit me, it is probably the regional/time settings on the server which control the format the date is in. That was confirmed by the sys admin. <BR><BR>Thanks once again for your help.<BR><BR>mj

  2. #2
    Join Date
    Dec 1969

    Default You *CAN* change the settings...

    ...in your ASP pages.<BR><BR>Just do:<BR><BR>&#060;%<BR>Session.LCID = &H0409 &#039; to set to US English<BR>%&#062;<BR>or<BR>&#060;%<BR>Session.LCI D = &H0809 &#039; to set to UK English<BR>%&#062;<BR>or use whatever is the right LCID (LoCale IDentifier) for the format you need.<BR><BR>You can even change this on the fly. Let&#039;s say your SQL Server DB is set up for US English and you want to server up UK pages. But you still need to give dates to SQL Server in the locale it is set up for.<BR><BR>SO:<BR><BR>&#060;%<BR>...<BR>... do a bunch of stuff ...<BR>...<BR>... ready to build a SQL query:<BR>...<BR>saveLCID = Session.LCID<BR>Session.LCID = &h0409 &#039; US English<BR>SQL = "SELECT * FROM table WHERE dateField = &#039;" & someVBSdateVariable & "&#039;"<BR>...<BR>Session.LCID = saveLCID<BR>Do Until RS.EOF<BR>&nbsp; &nbsp; Response.Write FormatDateTime( RS("dateField"), vbLongDate ) <BR>...<BR>%&#062;<BR><BR>See that? You slip into US English only long enough to create the textual form of the query. Then you go back to your current system default to do the HTML output, and you&#039;ll get whatever the user is expecting.<BR><BR>NOTE: THIS IS NECESSARY WHEN USING ACCESS!!!!<BR><BR>Because Access *ONLY* understands the US English form of date literal values!<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