Charlotte Foust
cfoust at infostatsystems.com
Tue Feb 17 09:42:17 CST 2009
I was being facetious, Gustav. I know that's hard to believe, but it
WAS Friday, after all. ;->
Charlotte
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Friday, February 13, 2009 1:21 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Don't miss this special occasion... (Unix/Posix
time)
Hi Charlotte
John wrote UTC time zone. But if you prefer, insert your own timezone
bias:
<code>
Public Function DateFromUnix( _
ByVal dblSeconds As Double, _
Optional lngLocalTimeBias As Long) _
As Date
' Converts UNIX (or POSIX) time value to UTC date value.
' Optionally, a local time bias can be specified; ' this must be in
minutes with a resolution of 15 minutes.
'
' Examples:
' UTC. dblSeconds: 1000000000, lngLocalTimeBias: 0
' 2001-09-09 01:46:40
' CET. dblSeconds: 1000000000, lngLocalTimeBias: -60
' 2001-09-09 02:46:40
'
' 2004-03-23. Cactus Data ApS. CPH.
' 2008-02-27. Constants renamed for clarity.
' UNIX epoch (start time).
Const cdatUnixEpoch As Date = #1/1/1970#
' Maximum time bias in seconds, 12 hours.
Const clngSecondsBiasMax As Long = 12& * 60&
' Count of seconds of one day.
Const clngSecondsPerDay As Long = 24& * 60& * 60&
Dim dblDays As Double
Dim dblDaysSeconds As Double
Dim lngSeconds As Long
Dim datTime As Date
' Limit intervals for DateAdd to Long to be acceptable.
dblDays = Int(dblSeconds / clngSecondsPerDay)
dblDaysSeconds = dblDays * clngSecondsPerDay
lngSeconds = dblSeconds - dblDaysSeconds
datTime = DateAdd("d", dblDays, cdatUnixEpoch)
datTime = DateAdd("s", lngSeconds, datTime)
If lngLocalTimeBias <> 0 Then
If Abs(lngLocalTimeBias) < clngSecondsBiasMax Then
datTime = DateAdd("n", -lngLocalTimeBias, datTime)
End If
End If
DateFromUnix = datTime
End Function
Public Function UnixTimeValue( _
ByVal datTime As Date, _
Optional ByVal lngLocalTimeBias As Long) _
As Double
' Converts UTC date value to UNIX (or POSIX) time value.
' Optionally, a local time bias can be specified; ' this must be in
minutes with a resolution of 15 minutes.
'
' Examples:
' UTC. datTime: #09/09/2001 01:46:40#, lngLocalTimeBias: 0
' 1000000000
' CET. datTime: #09/09/2001 02:46:40#, lngLocalTimeBias: -60
' 1000000000
'
' 2004-03-23. Cactus Data ApS. CPH.
' 2008-02-27. Constants renamed for clarity.
' UNIX epoch (start time).
Const cdatUnixEpoch As Date = #1/1/1970#
' Maximum time bias in seconds, 12 hours.
Const clngSecondsBiasMax As Long = 12& * 60&
Dim dblSeconds As Double
If lngLocalTimeBias <> 0 Then
If Abs(lngLocalTimeBias) < clngSecondsBiasMax Then
datTime = DateAdd("n", lngLocalTimeBias, datTime)
End If
End If
dblSeconds = DateDiff("s", cdatUnixEpoch, datTime)
UnixTimeValue = dblSeconds
End Function
</code>
Have fun!
/gustav
>>> cfoust at infostatsystems.com 13-02-2009 19:08 >>>
Is that Pacific or Eastern?
Charlotte Foust
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Friday, February 13, 2009 10:04 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Don't miss this special occasion...
There is something that is important happening today! And I just know
how interested you are in this bit of time trivia for all you IT geeks
out there ...
Many computer operating systems measure time by counting the number of
seconds before/after midnight of January 1, 1970. This is known as POSIX
or Universal Time Code (UTC) time.
Today, a memorable event occurs in UTC time.
On Friday, Feb 13 2009 at exactly 3:31:30 PM the UTC will be 1234567890
- the numbers of seconds since 1/1/70.
--
John W. Colby
www.ColbyConsulting.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com