...

View Full Version : ASP returns dayname in Italian !



WilliamHolmes
06-14-2007, 03:04 PM
Hi,

When i used to call date function in ASP it used to return them in English but now it has decided to return them in Italian.

Im not sure what has happend for it to to do this but can anyone help?

Thanks.

Daemonspyre
06-14-2007, 04:31 PM
Check your Session.LCID or the Regional Settings on your server.

If either of them is in Italian, then ASP's DATE() will return Italian text.

WilliamHolmes
06-14-2007, 05:10 PM
Perfect. Thanks very much, youve just saved me alot of hasstle.

Now im wondering that if i change the LCID to eg. England would the time be returned in GMT ? or is there any easy way of doing that?

Thanks again.

:thumbsup:

Daemonspyre
06-14-2007, 06:12 PM
Yes, but you would also be returning the dates in dd/mm/yyyy format.

Your currency would also be in UK pounds, not US dollars.

A PITA way is below (thank you to aspfaq.com for this code):



<%
' fill in your known bias here!

offset = 5 'This is how many hours off GMT you are. EST is 5, CST 6, etc.

' tell us what date you want

od = "2005-02-01 5:32 AM" 'Can be dynamically placed.

' find first Sunday in April 'for below, don't forget that DST has changed for 2007

for i = 1 to 7
if weekday("4/" & i & "/" & year(d))=1 then
startDST = cdate("4/" & i & "/" & year(d))
exit for
end if
next

' find last Sunday in October

for i = 31 to 25 step -1
if weekday("10/" & i & "/" & year(d))=1 then
endDST = cdate("10/" & i & "/" & year(d))
exit for
end if
next

' subtract hour from offset if within DST

if cdate(od) >= startDST and cdate(od) < endDST then
offset = offset - 1
end if

nd = dateadd("h", offset, od)

Response.Write("Current = " & od & "<Br>UTC = " & nd)
%>

WilliamHolmes
06-14-2007, 06:42 PM
Great thats give me the basis of a great start.

Great help !



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum