(RADIATOR) Converting Linux Epoch Date in VB Script / ASP
Hugh Irvine
hugh at open.com.au
Tue Jun 19 03:36:25 CDT 2001
Many thanks Michael -
I have copied this to Mike so he can include it in the "goodies".
cheers
Hugh
At 3:13 PM -0400 6/18/01, Michael Audet wrote:
>Not sure if I posted this... but I'll post it again.
>You guys can thank me later :)
>----------------------------------------------
>Problem: You are running Radiator and you want to display your SQL database
>of accounting logs via the web using ASP / VB script.
>Easy to do.. but you came across this strange thing of Radius storing the
>login date/time in Unix Epoch time (Time in seconds since Jan 1, 1970).
>So you want to find some code in VB to convert these seconds into Normal
>human time but for some reason you can't find the code on the net.
>Search no more...
>
>Solution: Block copy this into your .asp page and amaze your friends.
>------------------------------------------------
>
> Dim VBDate
>
> VBDate = DateAdd("s", PUT YOUR RADIATOR UNIX TIME HERE , "1/1/1970")
> VBDate = DateAdd("h", -5, VBDate) ' convert to your time zone: use -5 for
>Eastern, -8 pacific etc.
>
>'Now that we have the time.. we have to check daylight savings time
>
> Dim StartDaylight
> Dim EndDaylight
>
> ' get the last day of March by subtracting one day from 4/1
> StartDaylight = DateAdd("d", -1, DateSerial(Year(VBDate), 4, 1))
>
> ' now skip to the next Sunday
> StartDaylight = DateAdd("d", 5 - WeekDay(StartDaylight), StartDaylight)
> StartDaylight = DateAdd("h", 2, StartDaylight)
> EndDaylight = DateSerial(Year(VBDate), 11, 1)
>
> ' back up to the previous Sunday
> EndDaylight = DateAdd("d", -5 + WeekDay(EndDaylight), EndDaylight)
> EndDaylight = DateAdd("h", 1, EndDaylight)
>
> If (VBDate >= StartDaylight And VBDate < EndDaylight) Then
> VBDate = DateAdd("h", 1, VBDate)
> End If
>
>
>'Display your time
> response.write(VBDate)
>
>
>===
>Archive at http://www.open.com.au/archives/radiator/
>Announcements on radiator-announce at open.com.au
>To unsubscribe, email 'majordomo at open.com.au' with
>'unsubscribe radiator' in the body of the message.
--
NB: I am travelling this week, so there may be delays in our correspondence.
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
Platypus, Freeside, Interbiller, TACACS+, PAM, external, etc, etc.
Available on Unix, Linux, FreeBSD, Windows 95/98/2000, NT, MacOS X.
===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.
More information about the radiator
mailing list