By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,956 Members | 1,657 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,956 IT Pros & Developers. It's quick & easy.

Odd dates I need to process in an SQL database...

!NoItAll
100+
P: 296
Here is an example of a date that I have to process:

189617489.97

This is not a unix epoch (at least not the standard one that sets 0 at 1,1,1970).

Has anyone seen this before. The decimal never goes more than three digits (e.g. 190615658.415) so it's not an Access style date where the number before the decimal is the date and the number after it is the time.
I do know the system tracks to the second.
Aug 12 '16 #1
Share this Question
Share on Google+
1 Reply


!NoItAll
100+
P: 296
Answering my own question now...
The dates turn out to be frames-per-second since 1/1/1 with a test for leap-year offset. Frames Per Second = 30

VB.Net code to decode is:
Expand|Select|Wrap|Line Numbers
  1.     Private Function ENRTimeToDate(ENRTimeStamp As Double) As Date
  2.         Const FRAMES_PER_SECOND As Double = 30D
  3.         Const FRAMES_PER_DAY As Double = 2592000D
  4.  
  5.         ENRTimeStamp = ENRTimeStamp * 10000
  6.  
  7.         'Get the date
  8.         Dim ENRDays As Long = (ENRTimeStamp \ FRAMES_PER_DAY) - 2
  9.         Dim NewDate As Date = New Date(1, 1, 1).AddDays(ENRDays)
  10.         If Date.IsLeapYear(NewDate.Year) Then
  11.             NewDate = New Date(1, 1, 1).AddDays(ENRDays + 1)
  12.         End If
  13.  
  14.         'get the time
  15.         Dim ENRTime As Long = (ENRTimeStamp) Mod (FRAMES_PER_DAY)
  16.         Dim ENRSeconds As Long = ENRTime / FRAMES_PER_SECOND
  17.  
  18.         NewDate = NewDate.AddSeconds(ENRSeconds)
  19.  
  20.         Return NewDate
  21.  
  22.  
  23.     End Function
  24.  
Aug 17 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.