Actually this whole thing could have been done in one go if there was a 
function(s) to cast the properly formatted date and time string representations 
to typed data inside of a DATETIME function.  I am surprised that loading the 
string values into table works, but can't be cast to datatype directly in an 
expression..
Like

set var vDate Date = '01/01/2007'

will correctly cast to date, but you can't combine two strings inside DATETIME

set var vDateStr text = '01/01/2007'
set var vTimeStr text = '02:35:07PM'
set var vdate date = .vdatestr
set var vtime = .vtimestr

sho var results:
vDateStr = 01/01/2007         TEXT
vTimeStr = 02:35:07PM       TEXT
vdate       = 01/01/2007        DATE
vtime       = 14:35:07             TIME

BUT
using inderection:

set var vdt DATETIME = (datetime(&vdatestr, &vtimestr))
-ERROR- A left parenthesis cannot be followed by a binary operator. (2145)
-ERROR- Expression cannot be evaluated. (2179)

and

set var vdt DATETIME = (datetime(.vdatestr, .vtimestr))
-ERROR- Argument 1 of function DATETIME cannot be TEXT. (2153)
-ERROR- Expression cannot be evaluated. (2179)

So I wonder what is used for the logic when a table is loaded?

a Fixer would be like

set var vdt DATETIME = (datetime((strToDate(.vdatestr)), 
(strToTime(.vtimestr))))

would guarantee success in an expression.





----- Original Message ----- 
From: "James Bentley" <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Saturday, January 12, 2008 4:42 PM
Subject: [RBASE-L] - Re: DATETIME String Conversion ...


> Mike,
>
> One warning if you are going to mess with date and time formats.
> You need to be the only person on the system for the duration
> of you process as the canges affets all signed on.  This could
> have  serious unfavorable consequences to any forms that accept
> date input.l
>
> If you check my postings to this thread, it indeed can be done
> in one statement.
>
> Jim Bentley
>
> --- MikeB <[EMAIL PROTECTED]> wrote:
>
>> OK, here is the simple way in one go...
>>
>>
>>
>> {
>> Control via the Date Time Format Seq to match the input
>> Don't mess with functions, they won't convert in one go to
>> DateTime
>>
>> temp table StWills has Three cols:
>> One Date and One Time one Computed to DateTime
>> }
>>
>> SET DATE FORMAT     DD-MMM-YYYY
>> SET DATE SEQUENCE   ddmmyyyy
>> SET TIME FORMAT     HH:MM:SS AP
>> SET TIME SEQUENCE   hhmmss
>> SET VAR vstr = '03-Oct-2007 01:23:38 PM'
>> INSERT INTO stwills coldate, coltime SELECT
>> (SGET(.vstr,11,1)),
>> (SGET(.vstr,11,13)) FROM dummy
>>
>>
>> RETURN
>>
>>
>>
>
>
> Jim Bentley
> American Celiac Society
> [EMAIL PROTECTED]
> tel: 1-504-737-3293
>
>
> 
> ____________________________________________________________________________________
> Looking for last minute shopping deals?
> Find them fast with Yahoo! Search. 
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>
>
> 


Reply via email to