" /> CallTime - How to convert to Date - Genesys CTI User Forum

Author Topic: CallTime - How to convert to Date  (Read 4761 times)

Offline mgcristino

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
CallTime - How to convert to Date
« on: September 08, 2006, 08:28:24 AM »
Advertisement
Does anyone have a Oracle function to convert the Genesys Time to Timezone Date/Time with Daylight Saving Tim

Offline Haldane

  • Jr. Member
  • **
  • Posts: 72
  • Karma: 1
Re: CallTime - How to convert to Date
« Reply #1 on: September 09, 2006, 09:56:47 AM »
I have a fuction somewhere I'll send on to you.

Offline Scottyjohn

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 0
Re: CallTime - How to convert to Date
« Reply #2 on: September 11, 2006, 08:56:48 AM »
Hi,
If Genesys time is in UTC, here are a couple of Oracle SQL statements to cenvert to something more meaningful....

Convert to DD/MM/YYYY : TO_CHAR(TO_DATE('01.01.70','DD.MM.RR')+(<yourtimefieldname>/(60*60*24)),'DD/MM/YYYY')
Convert to HH24:MI:SS  : TO_CHAR(TO_DATE('01.01.70','DD.MM.RR')+(<yourtimefieldname>/(60*60*24)),'HH24:MI:SS')

Hope these help

Jeff

  • Guest
Re: CallTime - How to convert to Date
« Reply #3 on: September 12, 2006, 04:54:41 AM »
I am in UTC+3 timezone. Where do I add this?

tony

  • Guest
Re: CallTime - How to convert to Date
« Reply #4 on: September 12, 2006, 05:07:03 AM »
[quote author=Jeff link=topic=1822.msg5891#msg5891 date=1158036881]
I am in UTC+3 timezone. Where do I add this?
[/quote]

Guessing it would be:

Convert to DD/MM/YYYY : TO_CHAR(TO_DATE('01.01.70','DD.MM.RR')+((<yourtimefieldname>/(60*60*24)+10800)),'DD/MM/YYYY')
Convert to HH24:MI:SS  : TO_CHAR(TO_DATE('01.01.70','DD.MM.RR')+((<yourtimefieldname>/(60*60*24)+10800)),'HH24:MI:SS')

Although not ideal for daylight saving, if you need it...

Tony

Offline Haldane

  • Jr. Member
  • **
  • Posts: 72
  • Karma: 1
Re: CallTime - How to convert to Date
« Reply #5 on: September 20, 2006, 03:47:55 PM »
Jeff,
    Here's the function that I promised: You'll notice that I add 1hour for daylight savings "temp_utc := i_utc + 3600" so you can probably use this and add 3 hours for GMT3.



CREATE OR REPLACE FUNCTION "TO_GMT"  (i_utc NUMBER) RETURN DATE IS
 
  result DATE; -- The return result
  temp_utc NUMBER;

BEGIN

    IF (i_utc IS NULL) OR (i_utc = 0) THEN -- Don't Process with a null value
    result := NULL;

    Else

      temp_utc := i_utc + 3600;
      --temp_utc := i_utc;

    result := NEW_TIME(TO_DATE(TO_CHAR(TO_DATE _
    ('01/01/1970','DD/MM/YYYY')+ FLOOR(temp_utc/86400) _
    ,'DD/MM/YY ') ||FLOOR(MOD(temp_utc,86400)/3600) || ':' || _
                  FLOOR(MOD(temp_utc,3600)/60) || ':' || MOD(temp_utc,60), _
                  'DD/MM/YY HH24:MI:SS'), _
                'GMT', _
                'GMT');

    END IF;

    RETURN(result);

END TO_GMT;