Converting Unix epoch format to normal date for filePro
Larry Hoover
larry at hoovercs.com
Thu Jul 22 11:07:48 PDT 2010
Brilliant!! It works perfectly and is exactly what I was looking for.
This should be a documented function of filePro.
Thanks, Ken.
-Larry
Kenneth Brody wrote:
> On 7/22/2010 1:08 PM, Larry Hoover wrote:
>> When you take a Unix epoch formatted date such as: 1240432776, you can
>> convert it to a filePro friendly date such as 04/22/09 in Linux with the
>> command:
>> date +%D --date "Jan 1, 1970 00:00:00 +0000 + 1240432776 seconds"
>> I can't seem to find a way to do this in SCO Unix Openserver. The date
>> command is different than in Linux. Does anyone know offhand of a
>> compatible SCO Unix command to do this, or some way in filePro?
>
> How accurate do you need it? Do you need leap-seconds taken into account?
>
> There are 3,600 seconds in an hour, and 86,400 seconds in a day. Just use
> filePro date and time math to go from there.
>
> ========
> @keyT::input popup ti(10,.0) "Enter seconds since epoch☺ ":
> :ti = "":end:
> ::declare Epoch(10,mdyy/) ; Epoch = "01/01/1970":
> ::dt(10,mdyy/) = Epoch + int(ti/"86400"):
> ::tm(8,time) = mod(ti,"86400") / "3600":
> ::mesgbox ti < "equals" < dt < tm:
> ::end:
> ========
>
> You will probably have to adjust for timezones, however.
>
More information about the Filepro-list
mailing list