sUnixDate = "1235999914"
sNewDate = DateAdd("s",sUnixDate,#1970/1/1#)
sNewDate now contains the date according to the regional settings on
the computer eg:
'3/2/2009 1:18:34'
or
'2009/03/02 01:18:34'
Is there a way to specify a format for the date that is independent of
the Regional Settings on the computer?
I want the date to always be returned and displayed in the yyyy/mm/dd
hh:mm:ss format.
Thanks.
> sUnixDate = "1235999914"
> sNewDate = DateAdd("s",sUnixDate,#1970/1/1#)
>
> sNewDate now contains the date according to the regional settings on
> the computer eg:
>
> '3/2/2009 1:18:34'
> or
> '2009/03/02 01:18:34'
No, it does not.
sNewDate contains the date/time,
independent of the regional settings.
It does not contain the way it is transcribed into a string.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
>Andyza wrote on 04 mrt 2009 in microsoft.public.inetserver.asp.general:
>
>> sUnixDate = "1235999914"
>> sNewDate = DateAdd("s",sUnixDate,#1970/1/1#)
>>
>> sNewDate now contains the date according to the regional settings on
>> the computer eg:
>>
>> '3/2/2009 1:18:34'
>> or
>> '2009/03/02 01:18:34'
>
>No, it does not.
>
>sNewDate contains the date/time,
>independent of the regional settings.
>
>It does not contain the way it is transcribed into a string.
True, but it doesn't answer the question. VBScript's FormatDate
function can display a date in several formats, all of which refer to
the computer's regional settings. AFAIK, there's no way to specify how
you want the date to look independent of the regional settings.
I suppose you could write your own function to do the necessary
arithmetic on the date value and format it as you want.
--
Tim Slattery
MS MVP(Shell/User)
Slatt...@bls.gov
http://members.cox.net/slatteryt
Thanks.
Is there a way to display the date/time in the yyyy/mm/dd
hh:mm:ss format?
Thanks Bob.
This rought "first draft" seems to work for me:
Function pd(n, totalDigits)
if totalDigits > len(n) then
pd = String(totalDigits-len(n),"0") & n
else
pd = n
end if
End Function
sUnixDate = "1235999914"
sNewDate = DateAdd("s",sUnixDate,#1970/1/1#)
Response.Write("sNewDate : " & sNewDate & "<br>")
Response.Write(Year(sNewDate) & "/" & pd(Month(sNewDate),2) & "/" & pd
(Day(sNewDate),2))
Gives me: 2009/03/02
> "Evertjan." <exjxw.ha...@interxnl.net> wrote:
>
>>Andyza wrote on 04 mrt 2009 in microsoft.public.inetserver.asp.general:
>>
>>> sUnixDate = "1235999914"
>>> sNewDate = DateAdd("s",sUnixDate,#1970/1/1#)
>>>
>>> sNewDate now contains the date according to the regional settings on
>>> the computer eg:
>>>
>>> '3/2/2009 1:18:34'
>>> or
>>> '2009/03/02 01:18:34'
>>
>>No, it does not.
>>
>>sNewDate contains the date/time,
>>independent of the regional settings.
>>
>>It does not contain the way it is transcribed into a string.
>
> True, but it doesn't answer the question.
At least it answers a conceptual mistake in the OP's thought.
>>> Is there a way to specify a format for the date that
>>> is independent of the Regional Settings on the computer?
> VBScript's FormatDate
> function can display a date in several formats, all of which refer to
> the computer's regional settings. AFAIK, there's no way to specify how
> you want the date to look independent of the regional settings.
>
> I suppose you could write your own function to do the necessary
> arithmetic on the date value and format it as you want.
And that isn't a way, Tim?
I think it is, it is the best way for my and the OP's purpose
I never use FormatDate() but build the function myself.
sUnixDate = "1235999914"
sNewDate = DateAdd("s",sUnixDate,#1970/1/1#)
timeDutchString = day(sNewDate)&"-"&month(sNewDate)&"-"&year(sNewDate)&_
" "&minute(sNewDate)&":"&second(sNewDate)