Page 1 of 1
How to write datetime field in MySql? *Got it*
Posted: Fri Aug 25, 2017 6:11 am
by dutch
Hi All,
I have datetime field in MySql, but I don't know how to write it?
I try with FW_DTOT(date()) but it shows '25-08-2017 00:00:00'
Thanks in advance,
Re: How to write datetime field in MySql? *Got it*
Posted: Fri Aug 25, 2017 12:40 pm
by Rick Lipkin
Dutch
Try this :
Rick Lipkin
Re: How to write datetime field in MySql? *Got it*
Posted: Fri Aug 25, 2017 3:15 pm
by dutch
Dear Rick,
Thank you for your kind help. I found this function. It works well.
Code: Select all | Expand
oRs:Fields('datetime'):Value := FW_STR2DT(FW_DT2STR(date())+' '+time())
Thanks once again.
Re: How to write datetime field in MySql? *Got it*
Posted: Thu Sep 07, 2017 11:33 am
by nageswaragunupudi
Mr Dutch
oRs:DateTimeField := DateTime() // current datetime
oRs:DateTimeField := STOT( "20111010221020" ) // "YYYYMMDDHHMMSS"
Re: How to write datetime field in MySql? *Got it*
Posted: Thu Sep 07, 2017 12:52 pm
by dutch
Dear Mr.Rao,
Thanks a lot, I never know it.
nageswaragunupudi wrote:Mr Dutch
oRs:DateTimeField := DateTime() // current datetime
oRs:DateTimeField := STOT( "20111010221020" ) // "YYYYMMDDHHMMSS"
Re: How to write datetime field in MySql? *Got it* [RESUELTO]
Posted: Fri Nov 16, 2018 1:39 pm
by MarioG
Hola Gente
Retomo este tema, debido a que no estoy pudiendo guardar un valor DATETIME
- Utilizo lTDolphin.lib; no la que viene incluida en FWH
- utilizo HARBOUR 3.2 +BCC 7
Para agregar un recordset utilizo oServer:Insert( "mitabla", aCampos, aDatos )
En el campo DATETIME probé las indicadas en este post, sin exito
Probe:
dFEHora:= DtoC( dFecha )+' '+cHora
dFEHora:= FW_STR2DT(FW_DT2STR( dFecha )+' '+cHora)
dFEHora:= StoT( DtoS( dFecha )+Left( cHora,2)+SubStr(cHora,4,2 )+Right(cHora,2 ) )
dFeHora:= DateTime() (bastante llamativo que tampoco lo acepte) // aunque no me sirve porque la fecha puede no ser la actual
El capturador de error me devuelve: error de argumento
Alguna idea?
Re: How to write datetime field in MySql? *Got it*
Posted: Sun Nov 18, 2018 12:51 pm
by nageswaragunupudi
With TDolphin
===========
Code: Select all | Expand
dDate := Date()
tDateTime := DateTime()
oServer:Insert( "mitable", { "numfield", "datefield", "datetimefield" }, ;
{ 99, dDate, FW_DT2STR( tDateTime ) } )
If you have date and time separately
Code: Select all | Expand
dDate := Date()
dDatePart := Date()
cTimePart := TIME()
oServer:Insert( "mitable", { "numfield", "datefield", "datetimefield" }, ;
{ 99, dDate, FW_DT2STR( dDatePart ) + " " + cTimePart } )
Re: How to write datetime field in MySql? *Got it*
Posted: Tue Nov 20, 2018 12:48 am
by MarioG
Mr Rao
Thanks for your reply
I have two Datas : dTime (from a get) and cTime (return from Time())
So, I do not have a tDatetime Data
Re: How to write datetime field in MySql? *Got it*
Posted: Tue Nov 20, 2018 12:49 am
by MarioG
Sorry!!
I didn't read carefully
Re: How to write datetime field in MySql? *Got it*
Posted: Tue Nov 20, 2018 1:05 am
by MarioG
Many Thanks Mr Rao!
Work fine!!