Dennis,

Like you I thought, until a few months ago, that format did not work at all
with time variables.

Give these a try:

SET VAR VT TIME = 10:11:12
SET VAR VX TEXT = (FORMAT(.VT, 'HH:MM'))

My time FORMAT is HH:MM:SS & sequence is HHMMSS

At my R:> I get 10:11 for sho var vx - losing the seconds. Good.

I then tried changing my time sequence to HH:MM AM

SET VAR VT TIME = 10:11
SET VAR VX TEXT = (FORMAT(.VT, 'HH'))

At my R:> I get 10 for sho var vx - NO AM but not expected.

SET VAR VT = 11:12 pm fails.

If I then change VT to 13:12 VX returns 13 - NO PM either, but not needed as
such.

Now try putting the AM into the format: (FORMAT(.VT, 'HH AM'))

Result: 13 AM !!

So, formatting time is possible but care is needed. Perhaps this is one to
be "adjusted" in v7?

Regards,
Alastair.


----- Original Message -----
From: "Dennis McGrath" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 30, 2002 11:03 PM
Subject: RE: Time format/Sequence challenge?


> David,
>
> I created a test to find out:
>
> SET TIME FOR HHMM AP
> SET TIME SEQ HHMM
> SET VAR vTime = '1145'
> SEL * FROM TESTTIME
>  1145 AM
>  1145 PM
> SEL * FROM TESTTIME WHERE TESTTIME = .vTime
>  1145 AM
> SEL * FROM TESTTIME WHERE TESTTIME = (.vTime)
> -ERROR- Column TESTTIME must be compared to TIME values.
>
>
> This may shed some light on the subject.  Seems that when the interpreter
> looks at an expression it reads the time variable using the time FORMAT
> instead of converting the value to 24 hour time which be unambiguous and
> never fail.
>
> There is a similar issue with dates. With dates I can use the FORMAT()
> function to force date values in expressions to four digit years which are
> unambiguous.  Unfortunately FORMAT() does not work with time values, so
one
> has to find other solutions.
>
> In any case, this demo should help point to a workaround.
>
> --Dennis McGrath
>
>
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of David M. Blocker
> Sent: Saturday, November 30, 2002 1:02 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Time format/Sequence challenge?
>
>
> Dennis
>
> Any ideas on the original question, about why the query fails when time
> format is set to HH:MM AP?
>
> David Blocker
>
> ----- Original Message -----
> From: "Dennis McGrath" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, November 30, 2002 10:25 AM
> Subject: RE: Time format/Sequence challenge?
>
>
> > The rsyntax SET TIME point to the docs for the time data type.
> >
> > I have submitted the boo-boo to RDCC.
> >
> > Her is the correct syntax:
> >
> > SET TIME FOR HH:MM AP
> > SET TIME SEQ HHMM
> >
> > No quotes are needed as the interpreter is smart enough to know that the
> > TIME FOR setting may need a space.
> >
> > Now you can enter time as follows:
> > 11:45PM  will be displayed as 11:45 PM
> > 1145PM  will be displayed as 11:45 PM
> > 1145  will be displayed as 11:45 AM
> > 11PM  will be displayed as 11:00 PM
> > 11AM  will be displayed as 11:00 AM
> > 11  will be displayed as 11:00 AM
> > 1356 will be displayed as 1:56 PM
> >
> > you could also do:
> > SET TIME FOR HHMM AP
> > SET TIME SEQ HHMM
> > or
> > SET TIME FOR HHMMAP
> > SET TIME SEQ HHMM
> >
> > Hope this helps.
> >
> > --Dennis McGrath
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> > Behalf Of Nicky Avery
> > Sent: Saturday, November 30, 2002 3:22 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Time format/Sequence challenge?
> >
> >
> > Claudine Robbins wrote:
> >
> > >Well, it doesn't work anyway.  I tried the SET TIME HH:MM AP and it
> > >gives an "invalid command" error,
> > >
> >
> > Claudine,
> >
> > SET TIME is insufficient. It's necessary to specify the SEQ and FOR
> > separately and, I believe, to use AP, put the setting param in quotes
> >
> > RBHelp: "If the format contains spaces or commas, enclose the format in
> > quotes."
> >
> >
> > e.g:
> >
> > SET TIME SEQ 'HHMM AP'
> >
> > but using the above means that time has also to be entered in quotes
> > with a following AM or PM for correct results - a 24-hour clock
> > (military time) is much simpler.
> >
> > SET TIME FOR 'HH:MM AP'
> >
> >
> > David,
> >
> > Would the quotes make your code work in the desired way?
> >
> > Nicky
> >
> >
> >
> >
> > ================================================
> > TO SEE MESSAGE POSTING GUIDELINES:
> > Send a plain text email to [EMAIL PROTECTED]
> > In the message body, put just two words: INTRO rbase-l
> > ================================================
> > TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> > In the message body, put just two words: UNSUBSCRIBE rbase-l
> > ================================================
> > TO SEARCH ARCHIVES:
> > http://www.mail-archive.com/rbase-l%40sonetmail.com/
> >
> > ================================================
> > TO SEE MESSAGE POSTING GUIDELINES:
> > Send a plain text email to [EMAIL PROTECTED]
> > In the message body, put just two words: INTRO rbase-l
> > ================================================
> > TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> > In the message body, put just two words: UNSUBSCRIBE rbase-l
> > ================================================
> > TO SEARCH ARCHIVES:
> > http://www.mail-archive.com/rbase-l%40sonetmail.com/
> >
>
>
> ================================================
> TO SEE MESSAGE POSTING GUIDELINES:
> Send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: INTRO rbase-l
> ================================================
> TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: UNSUBSCRIBE rbase-l
> ================================================
> TO SEARCH ARCHIVES:
> http://www.mail-archive.com/rbase-l%40sonetmail.com/
>
> ================================================
> TO SEE MESSAGE POSTING GUIDELINES:
> Send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: INTRO rbase-l
> ================================================
> TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: UNSUBSCRIBE rbase-l
> ================================================
> TO SEARCH ARCHIVES:
> http://www.mail-archive.com/rbase-l%40sonetmail.com/

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to