I have a DateTime field whose value is “01/17/2006”. The output from “Cstr(MyDateTime_field)” = “1/17/2006” (leading zero truncated. I’m pretty sure in R6 the leading zero was not truncated. This new behavior is causing my db lookups to fail.
Can anyone confirm this behavior? Thanks. Thorne Ventura
Subject: Cstr truncates leading zero ?
No, you don’t. Date/Time fields don’t have a “format” and they don’t contain strings – they contain date values. Sure, the form will display the stored value with a particular format, depending on field settings and user preferences, but there is no text format directly associated with the date value. And when you get the value as a Date Variant in LotusScript, it’s just a number with an “I’m a date” flag set. Cstr uses your system settings to translate that to a string.
Subject: Not sure about Cstr, but why not use Format?
The “format” function will convert the date to a string value and allow you to specify the exact format for the date.
Subject: RE: Not sure about Cstr, but why not use Format?
And, not confirming or denying whether the default format has changed in R7 (I have no idea) but if it has, this is why you always use format if it’s all that important to you even if the default behavior currently matches your desires. 