[reordered to chronological]
Josh Assing <XjoshX@[EMAIL PROTECTED]
> wrote:
>>On 3 Jun 2007 02:26:06 GMT, rlewart@[EMAIL PROTECTED]
(Cass Lewart)
wrote:
>>
>>>Is there a direct assignment of dates like in Foxpro for DOS using
curly
>>>brackets, e.g. dt={02/02/2007} or do I have to use the CTOD function?
>>>
>>>dt=ctod("02/02/2007")
>On Sat, 02 Jun 2007 19:58:50 -0700, Josh Assing <XjoshX@[EMAIL PROTECTED]
>
wrote:
>
>>You can use the brackets only for a DATETIME vartype. for DATE types
your
>>limited to ctod() or date()
>I'm sorry -- I wrote too quickly...
>x={^2005-2-2}
>?VARTYPE(x)
>
>returns D (date)
>
>so you can use hte brackets, ctod() or date() -- I prefer the date()
method as
>I think it's easier to read.
I do not use absolute dates very much in my app, and most of my
manipulations are relative so I use thedate +/- number or gomonth().
I have a few cases where I build the string representation of a
date from a date. It is more awkward to break up the date into year,
month, and day, so I use dtoc() then to build a date delimited with
"{^" and "}". (If you do this, remember to set date ansi first and to
set the setting back after.)
If you have the pieces of the date already, then
date(theyear,themonth,theday) would be the easier approach. Beware,
however of passing date() a bad date. If a parameter is obviously
wrong (e.g. the 32nd of a month or the 13th month), an error is
thrown, but if a parameter is wrong by association with the other
parameters (e.g. April 31st), an empty date is returned. (This
behaviour is in VFP 9 SP 1 and VFP 6 SP 5 (and presumably the rest of
them.))
Sincerely,
Gene Wirchenko
Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.


|