dbTalk Databases Forums  

Date Time Conversion

comp.databases.paradox comp.databases.paradox


Discuss Date Time Conversion in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
hswerdfe@gmail.com
 
Posts: n/a

Default Date Time Conversion - 02-02-2009 , 11:57 AM






I have a string that looks like this
"2009-01-31 14:43:21"
its the ISO Standard
I would like to convert this type a variable of type datetime.is there
an easy way to do this in Objectpal?

I am using paradox 9 on Win XP

Reply With Quote
  #2  
Old   
Jim Giner
 
Posts: n/a

Default Re: Date Time Conversion - 02-02-2009 , 01:25 PM






One has to have their bde date setting matching this format, otherwise you
would have to manipulate this input to mathc your setting and then you can
use normal date/time functions. Bring it in to your code as a string value,
break it down into date and time pieces, convert to match your bde setting
and you should then have valid date/time fields.
<hswerdfe (AT) gmail (DOT) com> wrote

Quote:
I have a string that looks like this
"2009-01-31 14:43:21"
its the ISO Standard
I would like to convert this type a variable of type datetime.is there
an easy way to do this in Objectpal?

I am using paradox 9 on Win XP



Reply With Quote
  #3  
Old   
Jim Moseley
 
Posts: n/a

Default Re: Date Time Conversion - 02-02-2009 , 01:44 PM




Jim & O.P.,

Quote:
One has to have their bde date setting matching this format, otherwise you

would have to manipulate this input to mathc your setting and then you can

use normal date/time functions. Bring it in to your code as a string value,

break it down into date and time pieces, convert to match your bde setting

and you should then have valid date/time fields.
In addition, remember that you can cast a date as date(mm, dd, yyyy), where
each is an integer. Unfortunately, you can't do the same with a time. This
will let you ignore the date bde setting.

And, I agree that it is much easier to split the dateTime into a date() and
a time() component to work with. In the end, just merge them back together
using:
myDateTime = dateTime(myDate) + time(myTime)

HTH,
Jim Moseley


Reply With Quote
  #4  
Old   
hswerdfe@gmail.com
 
Posts: n/a

Default Re: Date Time Conversion - 02-02-2009 , 02:14 PM



Thanks for the help.
I have another question now.
How do I detect in code what my BDE datetime format is ?


On Feb 2, 2:44*pm, "Jim Moseley" <jm... (AT) mapson (DOT) attglobal.net> wrote:
Quote:
Jim & O.P.,

One has to have their bde date setting matching this format, otherwise you
would have to manipulate this input to mathc your setting and then you can
use normal date/time functions. *Bring it in to your code as a string value,
break it down into date and time pieces, convert to match your bde setting
and you should then have valid date/time fields.

In addition, remember that you can cast a date as date(mm, dd, yyyy), where
each is an integer. *Unfortunately, you can't do the same with a time. *This
will let you ignore the date bde setting. *

And, I agree that it is much easier to split the dateTime into a date() and
a time() component to work with. *In the end, just merge them back together
using:
* *myDateTime = dateTime(myDate) + time(myTime)

HTH,
Jim Moseley


Reply With Quote
  #5  
Old   
Tony McGuire
 
Posts: n/a

Default Re: Date Time Conversion - 02-02-2009 , 03:11 PM



hswerdfe (AT) gmail (DOT) com wrote:
Quote:
Thanks for the help.
I have another question now.
How do I detect in code what my BDE datetime format is ?

Would it be easier to set it to the specification you need, and not worry
about figure out the format it is in?

--
---------------
Tony McGuire


Reply With Quote
  #6  
Old   
Tom Krieg
 
Posts: n/a

Default Re: Date Time Conversion - 02-02-2009 , 06:54 PM



You could break up the string into date and time portions, and use
formatStringToDate and formatStringToTime.

Or you could use formatStringToDateTime.

Have a look at objectpal help, also look at the help for format, to see
the options for date and time formats.

hswerdfe (AT) gmail (DOT) com wrote:
Quote:
I have a string that looks like this
"2009-01-31 14:43:21"
its the ISO Standard
I would like to convert this type a variable of type datetime.is there
an easy way to do this in Objectpal?

I am using paradox 9 on Win XP

--
Tom Krieg

---------------
http://www.krieg.com.au
Please use the contact page to contact me via email


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.