Help understanding longint date time stamp code

View: New views
1 Messages — Rating Filter:   Alert me  

Help understanding longint date time stamp code

by John Baughman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

        I collected a method along the way  for creating a longint date time  
stamp. I have been using it for years and only tonight noticed that it  
was either creating and/or extracting a dts that is 1 day later than  
it should be. The time is 10pm on the 23rd and the extracted date is  
the 24th. I suspect that I am only noticing the problem because it is  
so close to midnight. Perhaps there is no problem with it during a  
normal work day.

        I really don't understand how this code works so am wondering if  
someone can see what might be wrong with it.

I think I got the method from a tech tip or perhaps from a 4DToday  
tech tip. Here is the parts of the code that do the heavy lifting...

Case of
               
        : ($Action="GetStamp")
                $RefDate:=!01/01/90!
                $Offset:=24*60*60
                $0:=($Date-$RefDate)*$Offset
                $0:=$0+($Time+0)
                               
        : ($Action="ExtractDateTime")
                $RefDate:=!01/01/90!
                $Offset:=24*60*60
                $PtrToDate->:=$RefDate+($DateTime/$Offset)
                $PtrToTime->:=Time(Time string($DateTime%$Offset))
                               
End case

        It is included in my tips and tricks database so I would really like  
to fix it as soon as possible.

Thanks,

John
**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************