Gustav Brock
Gustav at cactus.dk
Fri Feb 6 06:25:16 CST 2009
Hi all
Not a Friday joke, but did you know about the Rata Die numbering system for dates:
http://en.wikipedia.org/wiki/Rata_Die
However, these are quite easy to handle in Access:
<code>
Public Function DateFromRataDie(ByVal lngRataDie As Long) As Date
' Converts a date as Rata Die value to its date/time value.
' Rata Die is the count of days since 0001-01-01 00:00:00 UTC
'
' Zero value of Rata Die is 0001-01-01 00:00:00 UTC
' Offset in relation to the date of zero value of VB(A) date/time value
' is the year of date/time numeric value zero.
'
' 2009-02-06. Cactus Data ApS. CPH.
Const datZero As Date = #12:00:00 AM#
Dim datDate As Date
datDate = DateAdd("yyyy", -Year(datZero), DateAdd("d", lngRataDie, datZero))
DateFromRataDie = datDate
End Function
Public Function DateToRataDie(ByVal datDate As Date) As Long
' Converts a date/time value to its Rata Die value.
' Rata Die is the count of days since 0001-01-01 00:00:00 UTC
'
' Zero value of Rata Die is 0001-01-01 00:00:00 UTC
' Offset in relation to the date of zero value of VB(A) date/time value
' is the year of date/time numeric value zero.
'
' 2009-02-06. Cactus Data ApS. CPH.
Const datZero As Date = #12:00:00 AM#
Dim lngRataDie As Long
lngRataDie = DateDiff("d", datZero, DateAdd("yyyy", Year(datZero), datDate))
DateToRataDie = lngRataDie
End Function
</code>
/gustav