Re: format # of seconds to hh:mm
Posted in 2003
Topics: General Discussion
The Big Potatoe wrote:
> Jonathan Leffler wrote:
>
>>Thomas wrote:
>>
>>
>>>I am trying to trick some Infromix SQL command, so it will format the
>>>output of a query into the HH:MM. Say, a row data value 70 will be
>>>print as 01:10. I strugglled with UNITS, INTERVAL, EXTEND for a hour,
>>>but still get only syntax error. Someone help, please.
>>
>>
>>SELECT INTERVAL(0:0) HOUR TO MINUTE + 70 UNITS MINUTES
>>FROM ThereOrThereAbouts
>>
>>It isn't quite clear whether you're dealing with minutes or seconds, but
>>the basic principle applies.
>>
>
> Well, I run ...
>
> drop table tab1;
> create table tab1 (col1 int);
> insert into tab1 values (70);> select "I like my potatoes", ((datetime (00:00) hour to minute) + col1
> units minute) from tab1;
>
> and this produces ...
>
> (constant) (expression)
>
> I like my potatoes 01:10
>
> 201: A syntax error has occurred.
Exactly like that? With the correct result followed by a syntax error?
Seems odd.
> Or the following ...
>
> select "I liked my potatoes", ((interval (00:00) hour to minute) + col1
> units minute) from tab1;
They both run fine in IDS versions 7.31 & 9.21. What database server and
version are you running?
Cheers,
--
Mark.
+----------------------------------------------------------+-----------+
| Mark D. Stock mailto:mdstock@MydasSolutions.com |//////// /|
| Mydas Solutions Ltd http://MydasSolutions.com |///// / //|
| +-----------------------------------+//// / ///|
| |We value your comments, which have |/// / ////|
| |been recorded and automatically |// / /////|
| |emailed back to us for our records.|/ ////////|
+----------------------+-----------------------------------+-----------+
sending to informix-list
Mark D. Stock wrote:
> The Big Potatoe wrote:
>
>>Jonathan Leffler wrote:
>>
>>
>>>Thomas wrote:
>>>
>>>
>>>
>>>>I am trying to trick some Infromix SQL command, so it will format the
>>>>output of a query into the HH:MM. Say, a row data value 70 will be
>>>>print as 01:10. I strugglled with UNITS, INTERVAL, EXTEND for a hour,
>>>>but still get only syntax error. Someone help, please.
>>>
>>>
>>>SELECT INTERVAL(0:0) HOUR TO MINUTE + 70 UNITS MINUTES
>>
>>>FROM ThereOrThereAbouts
>>
>>>It isn't quite clear whether you're dealing with minutes or seconds, but
>>>the basic principle applies.
>>>
>>
>>Well, I run ...
>>
>>drop table tab1;
>>create table tab1 (col1 int);
>>insert into tab1 values (70);>>select "I like my potatoes", ((datetime (00:00) hour to minute) + col1
>>units minute) from tab1;
>>
>>and this produces ...
>>
>>(constant) (expression)
>>
>>I like my potatoes 01:10
>>
;) No, I had JLs example after that so it produced an error ;)
>> 201: A syntax error has occurred.>
>
> Exactly like that? With the correct result followed by a syntax error?
> Seems odd.
>
>
>>Or the following ...
>>
>>select "I liked my potatoes", ((interval (00:00) hour to minute) + col1
>>units minute) from tab1;
>
>
> They both run fine in IDS versions 7.31 & 9.21. What database server and
> version are you running?
>
> Cheers,
Err. that was my point, I was trying to demonstrate that it could be
either a datetime or an interval.
;)