Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Date format write from access


Message #1 by "Paul Cracknell" <paul.cracknell@b...> on Sun, 27 Jan 2002 09:58:43
I have a problem with a date written from a recordset, created from an 

access table, being displayed in US format (mm/dd/yy). I must find a way 

to display it in UK format (dd/mm/yy). 



The server and is configured to UK date settings and the format in ms 

access is set to dd/mm/yy.



I am guessing that this is a peculiarity of ADO but would really 

appreciate some help in solving this. The strange thing is that if I use 

the Date()function elsewhere, the date is written in UK format.



Thanks



Paul C 
Message #2 by "Rade Popovic" <poppublic@y...> on Sun, 27 Jan 2002 13:02:43 +0100
This is a multi-part message in MIME format.



------=_NextPart_000_0026_01C1A732.E84FECC0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



The best way handling the date format is to do this.



 myDate =3D recordset.Fields("myDate")

response.write Right("00" & Day(myDate),2) & "." & Right("00" & 

Month(myDate),2) & "." & Year(myDate)

'// this is dd.mm.yyyy. format,



Rade Popovic







----- Original Message -----

From: "Paul Cracknell" <paul.cracknell@b...>

To: "ASP Databases" <asp_databases@p...>

Sent: Sunday, January 27, 2002 9:58 AM

Subject: [asp_databases] Date format write from access





> I have a problem with a date written from a recordset, created from an 



> access table, being displayed in US format (mm/dd/yy). I must find a 

way

> to display it in UK format (dd/mm/yy).

>

> The server and is configured to UK date settings and the format in ms

> access is set to dd/mm/yy.

>

> I am guessing that this is a peculiarity of ADO but would really

> appreciate some help in solving this. The strange thing is that if I 

use

> the Date()function elsewhere, the date is written in UK format.

>

> Thanks

>

> Paul C




$subst('Email.Unsub').






Message #3 by "Dallas Martin" <dmartin@z...> on Sun, 27 Jan 2002 09:34:01 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_0013_01C1A715.C0F8B0C0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



try the technique of setting the locale ID.

here is a short asp file which displays the

date and time in several formats.



<%

localeIDS =3D Array (2048,1030,1031,1032,1033,1034,1035,1036,1039,1040)

amount =3D 99.99

for x =3D 0 to ubound(localeIDS)

 Session.LCID =3D localeIDS(x)

     response.write("<br>")

     response.write (Date)

     response.write("  - ")

     response.write(formatcurrency(amount))

next

%>



Dallas

  ----- Original Message -----

  From: Paul Cracknell

  To: ASP Databases

  Sent: Sunday, January 27, 2002 9:58 AM

  Subject: [asp_databases] Date format write from access





  I have a problem with a date written from a recordset, created from an 



  access table, being displayed in US format (mm/dd/yy). I must find a 

way

  to display it in UK format (dd/mm/yy).



  The server and is configured to UK date settings and the format in ms

  access is set to dd/mm/yy.



  I am guessing that this is a peculiarity of ADO but would really

  appreciate some help in solving this. The strange thing is that if I 

use

  the Date()function elsewhere, the date is written in UK format.



  Thanks



  Paul C




$subst('Email.Unsub').








Message #4 by "Dallas Martin" <dmartin@z...> on Sun, 27 Jan 2002 11:19:02 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_0004_01C1A724.6CAA83E0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



For those of us who have time on our hands,

here's all the locale IDs as copied from

Microsoft's web site.



The page will display the locale information

and a date and currency amount in the format

of the locale ID.



Some locale IDs would not display on

my machine because the locale group

information was not installed on my pc.

Hence the err checking.



<%

ON ERROR RESUME NEXT

dim localeIDS(133)

localeIDS(0) =3D "Afrikaans,af,0x0436,1078"

localeIDS(1) =3D "Albanian ,sq,0x041C,1052"

localeIDS(2) =3D "Arabic - Algeria,ar-dz,0x1401,5121"

localeIDS(3) =3D "Arabic - Bahrain,ar-bh,0x3C01,15361"

localeIDS(4) =3D "Arabic - Egypt,ar-eg,0x0C01,3073"

localeIDS(5) =3D "Arabic - Iraq,ar-iq,0x0801,2049"

localeIDS(6) =3D "Arabic - Jordan,ar-jo,0x2C01,11265"

localeIDS(7) =3D "Arabic - Kuwait,ar-kw,0x3401,13313"

localeIDS(8) =3D "Arabic - Lebanon,ar-lb,0x3001,12289"

localeIDS(9) =3D "Arabic - Libya,ar-ly,0x1001,4097"

localeIDS(10) =3D "Arabic - Morocco,ar-ma,0x1801,6145"

localeIDS(11) =3D "Arabic - Oman,ar-om,0x2001,8193"

localeIDS(12) =3D "Arabic - Qatar,ar-qa,0x4001,16385"

localeIDS(13) =3D "Arabic - Saudi Arabia,ar-sa,0x0401,1025"

localeIDS(14) =3D "Arabic - Syria,ar-sy,0x2801,10241"

localeIDS(15) =3D "Arabic - Tunisia,ar-tn,0x1C01,7169"

localeIDS(16) =3D "Arabic - Yemen,ar-ye,0x2401,9217"

localeIDS(17) =3D "Arabic - United Arab Emirates,ar-ae,0x3801,14337"

localeIDS(18) =3D "Armenian,hy,0x042B,1067"

localeIDS(19) =3D "Azeri - Cyrillic,az-az,0x082C, 2092"

localeIDS(20) =3D "Azeri - Latin,az-az,0x042C,1068"

localeIDS(21) =3D "Basque,eu,0x042D,1069"

localeIDS(22) =3D "Belarusian,be,0x0423,1059"

localeIDS(23) =3D "Bulgarian,bg,0x0402,1026"

localeIDS(24) =3D "Catalan,ca,0x0403,1027"

localeIDS(25) =3D "Chinese - China,zh-cn,0x0804,2052"

localeIDS(26) =3D "Chinese - Hong Kong S.A.R.,zh-hk,0x0C04,3076"

localeIDS(27) =3D "Chinese - Singapore,zh-sg,0x1004,4100"

localeIDS(28) =3D "Chinese - Taiwan,zh-tw,0x0404,1028"

localeIDS(29) =3D "Chinese - Macau S.A.R,zh-mo,0x1404,5124"

localeIDS(30) =3D "Croatian,hr,0x041A,1050"

localeIDS(31) =3D "Czech,cs,0x0405,1029"

localeIDS(32) =3D "Danish,da,0x0406,1030"

localeIDS(33) =3D "Dutch - Belgium,nl-be,0x0813,2067"

localeIDS(34) =3D "Dutch - The Netherlands,nl-nl,0x0413,1043"

localeIDS(35) =3D "English - Australia,en-au,0x0C09,3081"

localeIDS(36) =3D "English - Belize,en-bz,0x2809,10249"

localeIDS(37) =3D "English - Canada,en-ca,0x1009,4105"

localeIDS(38) =3D "English - Ireland,en-ie,0x1809,6153"

localeIDS(39) =3D "English - Jamaica,en-jm,0x2009,8201"

localeIDS(40) =3D "English - New Zealand,en-nz,0x1409,5129"

localeIDS(41) =3D "English - South Africa,en-za,0x1C09,7177"

localeIDS(42) =3D "English - Trinidad,en-tt,0x2C09,11273"

localeIDS(43) =3D "English - United Kingdom,en-gb,0x0809,2057"

localeIDS(44) =3D "English - United States,en-us,0x0409,1033"

localeIDS(45) =3D "English - Carribbean,en-cb,0x2409,9225"

localeIDS(46) =3D "English - Phillippines,en-ph,0x3409,13321"

localeIDS(47) =3D "Estonian,et,0x0425,1061"

localeIDS(48) =3D "FYRO Macedonian,mk,0x042F,1071"

localeIDS(49) =3D "Faroese,fo,0x0438,1080"

localeIDS(50) =3D "Farsi,fa,0x0429,1065"

localeIDS(51) =3D "Finnish,fi,0x040B,1035"

localeIDS(52) =3D "French - Belgium,fr-be,0x080C,2060"

localeIDS(53) =3D "French - Canada,fr-ca,0x0C0C,3084"

localeIDS(54) =3D "French - France,fr-fr,0x040C,1036"

localeIDS(55) =3D "French - Luxembourg,fr-lu,0x140C,5132"

localeIDS(56) =3D "French - Switzerland,fr-ch,0x100C,4108"

localeIDS(57) =3D "Gaelic - Scotland,gd,0x043C,1084"

localeIDS(58) =3D "Gaelic - Ireland,gd-ie,0x083C,2108"

localeIDS(59) =3D "German - Austria,de-at,0x0C07,3079"

localeIDS(60) =3D "German - Germany,de-de,0x0407,1031"

localeIDS(61) =3D "German - Liechtenstein,de-li,0x1407,5127"

localeIDS(62) =3D "German - Luxembourg,de-lu,0x1007,4103"

localeIDS(63) =3D "German - Switzerland,de-ch,0x0807,2055"

localeIDS(64) =3D "Greek,el,0x0408,1032"

localeIDS(65) =3D "Hebrew,he,0x040D,1037"

localeIDS(66) =3D "Hindi,hi,0x0439,1081"

localeIDS(67) =3D "Hungarian,hu,0x040E,1038"

localeIDS(68) =3D "Icelandic,is,0x040F,1039"

localeIDS(69) =3D "Indonesian,id,0x0421,1057"

localeIDS(70) =3D "Italian - Italy,it-it,0x0410,1040"

localeIDS(71) =3D "Italian - Switzerland,it-ch,0x0810,2064"

localeIDS(72) =3D "Japanese,ja,0x0411,1041"

localeIDS(73) =3D "Korean,ko,0x0412,1042"

localeIDS(74) =3D "Latvian,lv,0x0426,1062"

localeIDS(75) =3D "Lithuanian,lt,0x0427,1063"

localeIDS(76) =3D "Malay - Malaysia,ms-my,0x043E,1086"

localeIDS(77) =3D "Malay - Brunei,ms-bn,0x083E,2110"

localeIDS(78) =3D "Maltese,mt,0x043A,1082"

localeIDS(79) =3D "Marathi,mr,0x044E,1102"

localeIDS(80) =3D "Norwegian - Bokm=E5l,no-no,0x0414,1044"

localeIDS(81) =3D "Norwegian - Nynorsk,no-no,0x0814,2068"

localeIDS(82) =3D "Polish,pl,0x0415,1045"

localeIDS(83) =3D "Portuguese - Brazil,pt-br,0x0416,1046"

localeIDS(84) =3D "Portuguese - Portugal,pt-pt,0x0816,2070"

localeIDS(85) =3D "Raeto-Romance,rm,0x0417,1047"

localeIDS(86) =3D "Romanian - Moldova,ro-mo,0x0818,2072"

localeIDS(87) =3D "Romanian - Romania,ro,0x0418,1048"

localeIDS(88) =3D "Russian - Moldova,ru-mo,0x0819,2073"

localeIDS(89) =3D "Russian,ru,0x0419,1049"

localeIDS(90) =3D "Sanskrit,sa,0x044F,1103"

localeIDS(91) =3D "Serbian - Cyrillic,sr-sp,0x0C1A,3098"

localeIDS(92) =3D "Serbian - Latin,sr-sp,0x081A,2074"

localeIDS(93) =3D "Setsuana,tn,0x0432,1074"

localeIDS(94) =3D "Slovak,sk,0x041B,1051"

localeIDS(95) =3D "Slovenian,sl,0x0424,1060"

localeIDS(96) =3D "Sorbian,sb,0x042E,1070"

localeIDS(97) =3D "Spanish - Argentina,es-ar,0x2C0A,11274"

localeIDS(98) =3D "Spanish - Bolivia,es-bo,0x400A,16394"

localeIDS(99) =3D "Spanish - Chile,es-cl,0x340A,13322"

localeIDS(100) =3D "Spanish - Colombia,es-co,0x240A,9226"

localeIDS(101) =3D "Spanish - Costa Rica,es-cr,0x140A,5130"

localeIDS(102) =3D "Spanish - Dominican Republic,es-do,0x1C0A,7178"

localeIDS(103) =3D "Spanish - Ecuador,es-ec,0x300A,12298"

localeIDS(104) =3D "Spanish - El Salvador,es-sv,0x440A,17418"

localeIDS(105) =3D "Spanish - Guatemala,es-gt,0x100A,4106"

localeIDS(106) =3D "Spanish - Honduras,es-hn,0x480A,18442"

localeIDS(107) =3D "Spanish - Mexico,es-mx,0x080A,2058"

localeIDS(108) =3D "Spanish - Nicaragua,es-ni,0x4C0A,19466"

localeIDS(109) =3D "Spanish - Panama,es-pa,0x180A,6154"

localeIDS(110) =3D "Spanish - Paraguay,es-py,0x3C0A,15370"

localeIDS(111) =3D "Spanish - Peru,es-pe,0x280A,10250"

localeIDS(112) =3D "Spanish - Puerto Rico,es-pr,0x500A,20490"

localeIDS(113) =3D "Spanish - Spain,es-es,0x0C0A,1034"

localeIDS(114) =3D "Spanish - Uruguay,es-uy,0x380A,14346"

localeIDS(115) =3D "Spanish - Venezuela,es-ve,0x200A,8202"

localeIDS(116) =3D "Sutu,sx,0x0430,1072"

localeIDS(117) =3D "Swahili,sw,0x0441,1089"

localeIDS(118) =3D "Swedish - Finland,sv-fi,0x081D,2077"

localeIDS(119) =3D "Swedish - Sweden,sv-se,0x041D,1053"

localeIDS(120) =3D "Tamil,ta,0x0449,1097"

localeIDS(121) =3D "Tatar,tt,0x0444,1092"

localeIDS(122) =3D "Thai,th,0x041E,1054"

localeIDS(123) =3D "Tsonga,ts,0x0431,1073"

localeIDS(124) =3D "Turkish,tr,0x041F,1055"

localeIDS(125) =3D "Ukrainian,uk,0x0422,1058"

localeIDS(126) =3D "Urdu,ur,0x0420,1056"

localeIDS(127) =3D "Uzbek - Cyrillic,uz-uz,0x0843,2115"

localeIDS(128) =3D "Uzbek - Latin,uz-uz,0x0443,1091"

localeIDS(129) =3D "Vietnamese,vi,0x042A,1066"

localeIDS(130) =3D "Xhosa,xh,0x0434,1076"

localeIDS(131) =3D "Yiddish,yi,0x043D,1085"

localeIDS(132) =3D "Zulu,zu,0x0435,1077"

%>

<html>

<body>

<table border=3D1>

<tr><th>Nationality/Ethic Group</th><th>Symbol</th><th>Hex 

Value</th><th>Decimal Value</th><th>Date Format</th><th>Currency 

Format</th></tr>

<%

for x =3D 0 to 132

     strLocales =3D localeIDS(x)

     local =3D split(strLocales,",")

     response.write("<tr>")

     for y =3D 0 to 3

          response.write("<td>")

          response.write(local(y))

          response.write("</td>")

     next

     Session.LCID =3D local(3)

     if err.number =3D 0 then

      response.write("<td align=3D""center"">")

      response.write(Date)

      response.write("</td><td align=3D""center"">")

      response.write(formatcurrency(99.99))

      response.write("</td></tr>")

    else

        ' some LCIDs are not available on my pc

      response.write("<td align=3D""center"">")

    response.write("N/A")

    response.write("</td><td align=3D""center"">")

    response.write("N/A")

      response.write("</td></tr>")

    end if

    err.clear

next

%>

</table>

</body>

</html>



Dallas

  ----- Original Message -----

  From: Paul Cracknell

  To: ASP Databases

  Sent: Sunday, January 27, 2002 9:58 AM

  Subject: [asp_databases] Date format write from access





  I have a problem with a date written from a recordset, created from an 



  access table, being displayed in US format (mm/dd/yy). I must find a 

way

  to display it in UK format (dd/mm/yy).



  The server and is configured to UK date settings and the format in ms

  access is set to dd/mm/yy.



  I am guessing that this is a peculiarity of ADO but would really

  appreciate some help in solving this. The strange thing is that if I 

use

  the Date()function elsewhere, the date is written in UK format.



  Thanks



  Paul C




$subst('Email.Unsub').









  Return to Index