FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Convertir Fecha y Hora en TimeStamp
Posts: 485
Joined: Fri Feb 09, 2007 10:34 AM
Convertir Fecha y Hora en TimeStamp
Posted: Thu Dec 05, 2013 02:10 PM

Muy buenas foro, tengo que convertir una fecha y hora en formato timestamp

¿Tenéis un código por ahí?

Muchas Gracias

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Convertir Fecha y Hora en TimeStamp
Posted: Thu Dec 05, 2013 02:44 PM
Softruz

To create a DateTime expression you can do it like this
Code (fw): Select all Collapse
dDateTime := dtoc(date())+" "+Time()

If you wish to convert a DateTime expression from a Sql Table back to a standard Date expression you can use this function.
Code (fw): Select all Collapse
dDate := TtoDate( oRs:Fields("DateTime"):Value )

//------------------------------
Function TtoDate( tDate )

If empty( tDate)
   Return( ctod("00/00/00"))
Endif

If ValType( tDate ) = "D"
   Return(tDate )
Endif

Return( stod( substr( ttos( tDate ), 1, 8 ) ))


Rick Lipkin

Continue the discussion