Service Connect: Parsing DateTimes

You need a "T" in there to denote the beginning of the Time segment. Thus "YYYY-MM-DDThh:mm:ss" is your format and gets you something that looks like "2009-08-04T15:07:35" as output. The formats for these things in Service Connect are XML Schema formats, which are a touch different than standard programming language and database formats many are used to.

--- In vantage@yahoogroups.com, "Brian W. Spolarich " <bspolarich@...> wrote:
>
> Can one use the dateTimeFromString() functoid to actually parse a
> DateTime in SC?
>
>
>
> I can parse a date (e.g. "MM-DD-YYYY") easily enough, but if I try to
> specific a format string such as "MM-DD-YYYY hh:mm:ss" the parser blows
> up and says:
>
>
>
> <SrcFile>Conversion.cpp</SrcFile>
>
> <SrcLine>240</SrcLine>
>
> </Error>
>
> <Error>
>
> <Type>COM</Type>
>
> <Code>0x80004005</Code>
>
> <Descr>Failed to parse date: Failed to parse format string: Format
> string has odd characters.</Descr>
>
> <Source>msxml4.dll</Source>
>
> </Error>
>
> </ErrHistory>
>
>
>
> The SC docs say this, and omit any notion of Time in a dateTime which
> seems, well, rather stupid. What am I missing?
>
>
>
> -bws
>
> Interpretation of Format String by parseDateTime Functoid
>
> The parseDateTime functoid interprets the specified string according to
> the format string, specified as the second parameter. The parseDateTime
> functoid uses the following rules, when interpreting the specified
> string:
>
> * Interpretation of date format string parts:
>
> Format string part
>
> Interpretation
>
> YY
>
> Year, short form.
>
> For example, 83 or 07.
>
> YYYY
>
> Year, long form.
>
> For example, 1983 or 2007.
>
> M
>
> Month, short form. If the month consists of two digits, both digits are
> displayed.
>
> For example, 5 for May or 11 for November.
>
> MM
>
> Month, long form (single digit values have a leading zero).
>
> For example, 05 for May or 11 for November.
>
> D
>
> Day, short form. If the day consists of two digits, both digits are
> displayed.
>
> For example, 5 or 22.
>
> DD
>
> Day, long form (single digit values have a leading zero).
>
> For example, 05 or 22.
>
> * Note: All format string parts (year, month and day) are
> required. A format string with missing part(s), such as dd-mm, cannot be
> used.
> * Interpretation of separators:
>
> The format string includes separator characters. The set of separator
> characters is limited to "/", "-" and ".".
>
> The separators are required, as a format string without separators may
> not be correctly interpreted.
>
>
>
>
>
> --
>
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
> Picometrix
>
> bspolarich@...
> <mailto:bspolarich@...> ~ 734-864-5618 ~
> www.advancedphotonix.com <http://www.advancedphotonix.com>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
Can one use the dateTimeFromString() functoid to actually parse a
DateTime in SC?



I can parse a date (e.g. "MM-DD-YYYY") easily enough, but if I try to
specific a format string such as "MM-DD-YYYY hh:mm:ss" the parser blows
up and says:



<SrcFile>Conversion.cpp</SrcFile>

<SrcLine>240</SrcLine>

</Error>

<Error>

<Type>COM</Type>

<Code>0x80004005</Code>

<Descr>Failed to parse date: Failed to parse format string: Format
string has odd characters.</Descr>

<Source>msxml4.dll</Source>

</Error>

</ErrHistory>



The SC docs say this, and omit any notion of Time in a dateTime which
seems, well, rather stupid. What am I missing?



-bws

Interpretation of Format String by parseDateTime Functoid

The parseDateTime functoid interprets the specified string according to
the format string, specified as the second parameter. The parseDateTime
functoid uses the following rules, when interpreting the specified
string:

* Interpretation of date format string parts:

Format string part

Interpretation

YY

Year, short form.

For example, 83 or 07.

YYYY

Year, long form.

For example, 1983 or 2007.

M

Month, short form. If the month consists of two digits, both digits are
displayed.

For example, 5 for May or 11 for November.

MM

Month, long form (single digit values have a leading zero).

For example, 05 for May or 11 for November.

D

Day, short form. If the day consists of two digits, both digits are
displayed.

For example, 5 or 22.

DD

Day, long form (single digit values have a leading zero).

For example, 05 or 22.

* Note: All format string parts (year, month and day) are
required. A format string with missing part(s), such as dd-mm, cannot be
used.
* Interpretation of separators:

The format string includes separator characters. The set of separator
characters is limited to "/", "-" and ".".

The separators are required, as a format string without separators may
not be correctly interpreted.





--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@...
<mailto:bspolarich@...> ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>





[Non-text portions of this message have been removed]