How to write datetime field in MySql? *Got it*

How to write datetime field in MySql? *Got it*

Postby dutch » Fri Aug 25, 2017 6:11 am

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,
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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to write datetime field in MySql? *Got it*

Postby Rick Lipkin » Fri Aug 25, 2017 12:40 pm

Dutch

Try this :

Code: Select all  Expand view


oRs:Fields("Date"):Value := Dtoc(date())+" "+Time()

 


Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: How to write datetime field in MySql? *Got it*

Postby dutch » Fri Aug 25, 2017 3:15 pm

Dear Rick,

Thank you for your kind help. I found this function. It works well.
Code: Select all  Expand view
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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to write datetime field in MySql? *Got it*

Postby nageswaragunupudi » Thu Sep 07, 2017 11:33 am

Mr Dutch

oRs:DateTimeField := DateTime() // current datetime
oRs:DateTimeField := STOT( "20111010221020" ) // "YYYYMMDDHHMMSS"
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to write datetime field in MySql? *Got it*

Postby dutch » Thu Sep 07, 2017 12:52 pm

Dear Mr.Rao,

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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to write datetime field in MySql? *Got it* [RESUELTO]

Postby MarioG » Fri Nov 16, 2018 1:39 pm

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?
Last edited by MarioG on Tue Nov 20, 2018 1:05 am, edited 1 time in total.
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: How to write datetime field in MySql? *Got it*

Postby nageswaragunupudi » Sun Nov 18, 2018 12:51 pm

With TDolphin
===========
Code: Select all  Expand view
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 view
dDate       := Date()
dDatePart   := Date()
cTimePart   := TIME()

oServer:Insert( "mitable", { "numfield", "datefield", "datetimefield" }, ;
                { 99, dDate, FW_DT2STR( dDatePart ) + " " + cTimePart } )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to write datetime field in MySql? *Got it*

Postby MarioG » Tue Nov 20, 2018 12:48 am

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
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: How to write datetime field in MySql? *Got it*

Postby MarioG » Tue Nov 20, 2018 12:49 am

Sorry!!
I didn't read carefully
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: How to write datetime field in MySql? *Got it*

Postby MarioG » Tue Nov 20, 2018 1:05 am

Many Thanks Mr Rao!
Work fine!!
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 114 guests