Home > Archive > SQL Anywhere Feedback > January 2006 > Datetime simple conversion









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Datetime simple conversion
Pavel Karady

2006-01-18, 7:23 am

Greetings hippies,

is there any single function in ASA, that converts from one date/time format
to another date/time format, or gives a difference between two formats in a
desired format in one single slap?

What I am trying to accomplish is the difference between two timestamps; I'm
interested in days (DATEDIFF(day,@t1,@t
2)) and 'hh:nn:ss' results. There is
only one way of reaching 'hh:nn:ss' that I know about:

TRUNCNUM(TRUNCNUM(DA
TEDIFF(second,@t1,@t
2)/60,0)/60,0) || ':' ||
TRUNCNUM(DATEDIFF(se
cond,@t1,@t2)/60,0) || ':' ||
MOD(DATEDIFF(second,
@t1,@t2),60)

So, this is: getting the difference in seconds and then recalculating the
hours, minutes and actual seconds from it.

I thought of (SECONDS(@t2) - SECONDS(@t1)), but then converting the seconds
to a 'hh:nn:ss' format seems to be the same problem again. A statement like
CONVERTDATE(@param1,
seconds, @param2, 'hh:nn:dd') would be of a great help
in this case. Maybe there is such a command or it's just easily replaceable
with currently existing commands? Being able to use
DATEDIFF('hh:nn:ss',
@t1,@t2) would be a *very fine* thing also!

My regards,
Pavel


Nick Elson

2006-01-19, 9:23 am

Pavel

I believe you are using the wrong newsgroup for this.

I am posting this to the general newsgroup so look there for responses.

This newsgroup is intended for product enhancement suggestions and
feature change discussions and your postings have been more about
'how to' and 'what if' scenarios. On the general group you will typically
find more individuals listing to you postings.

Similarily, SQL Remote postings should go to the
sybase.public.sqlanywhere.replication newsgroup.

"Pavel Karady" <pavel_ns. ns_karady@ns_kogerus
a.com> wrote in message
news:43ce2739$1@foru
ms-2-dub...
> Greetings hippies,
>
> is there any single function in ASA, that converts from one date/time
> format to another date/time format, or gives a difference between two
> formats in a desired format in one single slap?
>
> What I am trying to accomplish is the difference between two timestamps;
> I'm interested in days (DATEDIFF(day,@t1,@t
2)) and 'hh:nn:ss' results.
> There is only one way of reaching 'hh:nn:ss' that I know about :
>
> TRUNCNUM(TRUNCNUM(DA
TEDIFF(second,@t1,@t
2)/60,0)/60,0) || ':' ||
> TRUNCNUM(DATEDIFF(se
cond,@t1,@t2)/60,0) || ':' ||
> MOD(DATEDIFF(second,
@t1,@t2),60)
>
> So, this is: getting the difference in seconds and then recalculating the
> hours, minutes and actual seconds from it.
>
> I thought of (SECONDS(@t2) - SECONDS(@t1)), but then converting the
> seconds to a 'hh:nn:ss' format seems to be the same problem again. A
> statement like CONVERTDATE(@param1,
seconds, @param2, 'hh:nn:dd') would be
> of a great help in this case. Maybe there is such a command or it's just
> easily replaceable with currently existing commands? Being able to use
> DATEDIFF('hh:nn:ss',
@t1,@t2) would be a *very fine* thing also!
>
> My regards,
> Pavel
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com