Re: Unix date -> DATETIME
Posted in 1992
Quoting Stuart Hemming... } } Anyone out there know of a way of coverting a unix 4-byte date to } DATETIME format? } Hmmm... I'd write a C function that you pass it the seconds-since-midnight and it would return the tm_year, tm_mon, tm_mday, tm_hour, tm_min, and tm_sec values from a "tm" structure. In your 4GL program you'd have code like this: DEFINE dummy CHAR(19) DEFINE right_now DATETIME YEAR TO SEC CALL time_func(clock) RETURNING tm_year, tm_mon, tm_mday, tm_hour, tm_min, and tm_sec LET dummy = tm_year USING "&&&&", "-", tm_mon USING "&&", "-", tm_mday USING "&&", " ", tm_hour USING "&&", ":", tm_min USING "&&", ":", tm_sec USING "&&", ":" LET right_now = dummy You need that intermediate step with the "dummy" variable otherwise you'll get a compile-time error. DAS -- David Snyder @ Snide Computer Services - Folcroft, PA Current Release is db4glgen-3.7 UUCP: ..!uunet!das13!dave INTERNET: dave.snyder@snide.com