(RADIATOR) Converting Linux Epoch Date in VB Script / ASP

Mike McCauley mikem at open.com.au
Wed Jun 20 09:30:50 CDT 2001


Hi Michael,

Thanks very much for that. I have added it to the goodies directory with credit
to you.

Cheers.

On Jun 19,  6:36pm, Hugh Irvine wrote:
> Subject: Re: (RADIATOR) Converting Linux Epoch Date in VB Script / ASP
>
> 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.
>
>-- End of excerpt from Hugh Irvine



-- 
Mike McCauley                               mikem at open.com.au
Open System Consultants Pty. Ltd            Unix, Perl, Motif, C++, WWW
24 Bateman St Hampton, VIC 3188 Australia   http://www.open.com.au
Phone +61 3 9598-0985                       Fax   +61 3 9598-0955

Radiator: the most portable, flexible and configurable RADIUS server 
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald, 
Platypus, Freeside, TACACS+, PAM, external, Active Directory etc etc 
on Unix, Win95/8, 2000, NT, MacOS 9, 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