Karen,

This was tested in 9.1

SET VAR vNow DATETIME = .#NOW


I created a table mytable with one DATETIME column mynow


Then I issued the command

INSERT INTO mytable VALUES (.vNow)


No errors were generated in any of these steps.


Jan


-----Original Message-----
 From: [email protected]
 To: [email protected] (RBASE-L Mailing List)
 Date: Tue, 16 Oct 2012 11:08:44 -0400 (EDT)
 Subject: [RBASE-L] - Datetime tutorial

 Here's one for the slow list...  So far in my RBase career, I have
 been blessedly spared from doing time arithmetic.  That's about
 to change.

 Although this client has purchased some version of 9.x, for the
 immediate need this will be done in 7.6.

 I'm still trying to get an answer on whether I need to track time only,
 or whether I will need a DateTime.  I've been playing around with
 DateTime and am totally confused.  I've read all the help screens
 I could find but mine aren't working that way!

 If I do:   SET VAR vDatetime = .#NOW
 the datatype is Text and cannot be used for arithmetic

 If I do:  SET VAR vDatetime DATETIME = .#NOW
 I get an error message about my variable not having the same data type

 If I do:  SET VAR vDatetime DATETIME = (DATETIME(.#date, .#time))
 then I do get a datetime variable, and it appears I can use these for
 arithmetic.  If I subtract 2 datetime variables I get an integer which I
 suspect is in seconds, right?  So basically the .#now is not good for calcs?

 Now part two.  I set up a temp table with a column with DATETIME
 data type, and am incapable of getting a value loaded.  Using my now
 valid DateTime variables, I try to do an insert and I get the same error
 message above about invalid data types:
        insert into testklt (onedatetime) values .vDateTime

 Hard to believe I've gotten away with not a single DateTime in my clients,
 isn't it??   Well, now I might need to use it.  
       

 Karen
 

Reply via email to