How to write datetime field in MySql? *Got it*
How to write datetime field in MySql? *Got it*
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,
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,
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- Rick Lipkin
- Posts: 2674
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: How to write datetime field in MySql? *Got it*
Dutch
Try this :
Rick Lipkin
Try this :
Code: Select all | Expand
oRs:Fields("Date"):Value := Dtoc(date())+" "+Time()
Rick Lipkin
Re: How to write datetime field in MySql? *Got it*
Dear Rick,
Thank you for your kind help. I found this function. It works well.
Thanks once again.
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.
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: How to write datetime field in MySql? *Got it*
Mr Dutch
oRs:DateTimeField := DateTime() // current datetime
oRs:DateTimeField := STOT( "20111010221020" ) // "YYYYMMDDHHMMSS"
oRs:DateTimeField := DateTime() // current datetime
oRs:DateTimeField := STOT( "20111010221020" ) // "YYYYMMDDHHMMSS"
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: How to write datetime field in MySql? *Got it*
Dear Mr.Rao,
Thanks a lot, I never know it.
Thanks a lot, I never know it.
nageswaragunupudi wrote:Mr Dutch
oRs:DateTimeField := DateTime() // current datetime
oRs:DateTimeField := STOT( "20111010221020" ) // "YYYYMMDDHHMMSS"
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- MarioG
- Posts: 1380
- Joined: Fri Oct 14, 2005 1:28 pm
- Location: Resistencia - Chaco - AR
- Been thanked: 2 times
Re: How to write datetime field in MySql? *Got it* [RESUELTO]
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?
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?
Last edited by MarioG on Tue Nov 20, 2018 1:05 am, edited 1 time in total.
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
Chaco - Argentina
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: How to write datetime field in MySql? *Got it*
With TDolphin
===========
If you have date and time separately
===========
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 } )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- MarioG
- Posts: 1380
- Joined: Fri Oct 14, 2005 1:28 pm
- Location: Resistencia - Chaco - AR
- Been thanked: 2 times
Re: How to write datetime field in MySql? *Got it*
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
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
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
Chaco - Argentina
- MarioG
- Posts: 1380
- Joined: Fri Oct 14, 2005 1:28 pm
- Location: Resistencia - Chaco - AR
- Been thanked: 2 times
Re: How to write datetime field in MySql? *Got it*
Sorry!!
I didn't read carefully
I didn't read carefully
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
Chaco - Argentina
- MarioG
- Posts: 1380
- Joined: Fri Oct 14, 2005 1:28 pm
- Location: Resistencia - Chaco - AR
- Been thanked: 2 times
Re: How to write datetime field in MySql? *Got it*
Many Thanks Mr Rao!
Work fine!!
Work fine!!
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
Chaco - Argentina