tTimeStamp format

155 views
Skip to first unread message

Alain Aupeix

unread,
Jun 15, 2025, 3:27:59 AMJun 15
to Harbour Users
Hi,

I try to convert et filename to a date.

Example :

Here is what I do :

--------------------------------
function main(fichier)
local theTime, theDate

theTime=left(fichier,at(".",fichier)-1)
theTime=left(theTime,len(theTime)-3)
qout(theTime)
theDate=hb_TtoS(theTime)

qout(theDate)

return nil
-----------------------------------

I first don't use val(), but with or without val() I have the error :

alain@Gramps-JujuLand2:$ ./time2date 1566392757511.jpg

1566392757
Error BASE/3012  Argument error: HB_TTOS
Called from HB_TTOS(0)
Called from MAIN(7)

I can't figure the tTimestamp format

Thanks

A+
--
------------------------------------------------------------------------
*Alain Aupeix*
Sites web : JujuLand <http://jujuland.pagesperso-orange.fr/> |
Pissobi-Lacassagne <http://pissobi-lacassagne.pagesperso-orange.fr/> |
Gadel <https://www.gadel-environnement.org/>
------------------------------------------------------------------------
X.ubuntu 16.04 | H.arbour 3.2.0-1 (r2024-09-14 21:26) | Hw.gui 2.23-8dev
(r3481) | G.ramps 5.1.2
------------------------------------------------------------------------

Alain Aupeix

unread,
Jun 15, 2025, 6:10:26 AMJun 15
to Harbour Users
Hi,

As it seems there is no harbour function to convert it to a string, I
tried and succeeded like this :

function main(fichier)
local theTime, theDate:=""

theTime=left(fichier,at(".",fichier)-1)
theTime=left(theTime,len(theTime)-3)

hb_ProcessRun("date --iso-8601=seconds --universal
--date=@"+theTime,,@theDate)
qout(theDate)

return nil

W.

unread,
Jul 6, 2025, 4:42:06 PM (14 days ago) Jul 6
to Harbour Users
You can process unixtime with simple calculations:

? hb_NtoT( 1566392757 / 86400 + 2440587.5 )
? 0d19700101 + 1566392757 / 86400
? hb_TtoS( hb_NtoT( 1566392757 / 86400 + 2440587.5 ) )

Regards,
w.
Reply all
Reply to author
Forward
0 new messages