Date Format "2009-03-06T09:00:00"

Date Format "2009-03-06T09:00:00"

Postby Jeff Barnes » Thu Jun 04, 2009 12:15 am

Hi,

I need to send a date/time combination as a Date ... how can this be done?

I need it in this format:
2009-03-06T09:00:00
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Date Format "2009-03-06T09:00:00"

Postby nageswaragunupudi » Thu Jun 04, 2009 2:05 am

If you are using XHarbour
Code: Select all  Expand view
  local d  := datetime()

   Set( _SET_DATEFORMAT, 'YYYY-MM-DD' )
   SET TIME FORMAT TO 'HH:MM:SS'

   MsgInfo( TToC( d ) )
 


Using Harbour or XHarbour, another method:
Code: Select all  Expand view
  MsgInfo( cValToStr( d, 'YYYY-MM-DD' ) + ' ' + Time() )

Second method works without changing the Date Format. cValToStr() is FWH function.
Regards

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

Re: Date Format "2009-03-06T09:00:00"

Postby Jeff Barnes » Sun Jun 07, 2009 12:13 am

Thanks, it works now.

Based on your help I ended up using this:

Code: Select all  Expand view
Set( _SET_DATEFORMAT, 'YYYY-MM-DD' )
SET TIME FORMAT TO 'HH:MM:SS'
dTimeStart := CtoT( DtoC(Date())+" 09:00:00")
dTimeEnd   := CtoT( DtoC(Date())+" 10:00:00")
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Date Format "2009-03-06T09:00:00"

Postby nageswaragunupudi » Sun Jun 07, 2009 12:29 am

You can also write
Code: Select all  Expand view
dTimeStart := Date() + 9/24
dTimeEnd := Date() + 10/24
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 96 guests