Archive

Posts Tagged ‘convert’

Till New Year

Thursday, 2 July, 2009 Leave a comment
SELECT 'Till the New Year ' ||
to_char(extract(YEAR FROM SYSDATE) + 1) || ' - ' ||
           trunc(months_between(to_date('01.01.' ||
to_char(extract(YEAR FROM SYSDATE) + 1), 'dd.mm.yyyy'), SYSDATE)) 
           || ' months ' ||
to_char(LAST_DAY(SYSDATE) - SYSDATE) || ' day ' ||
to_char(23 - to_number(substr(to_char(SYSDATE, 'hh24:mi:ss'), 1, 2))) 
           || ' hh ' ||
to_char(59 - to_number(substr(to_char(SYSDATE, 'hh24:mi:ss'), 4, 2))) 
           || ' mi ' ||
to_char(59 - to_number(substr(to_char(SYSDATE, 'hh24:mi:ss'), 7, 2))) 
           || ' ss ' || '[today:' ||
to_char(SYSDATE, 'mm:dd:yyyy hh24:mi:ss') || ']' AS "Happy New Year!!!"
FROM dual;
Categories: PL/SQL Tags: , ,

[PL\SQL] Convert seconds to Day hour : min : sec

Thursday, 2 July, 2009 Leave a comment
variable vSec number;
exec :vSec := 68400;
SELECT
to_char(trunc(:vSec / 60 / 60 / 24), '09') || ' [day]' ||
to_char(trunc(MOD(:vSec / 60 / 60, 24)), '09') ||' [hh24]' ||
to_char(trunc(MOD(:vSec, 3600) / 60), '09') || ' [mi]' ||
to_char(MOD(MOD(:vSec, 3600), 60), '09') || ' [ss]'
FROM dual;
Categories: PL/SQL Tags: , ,

[PLSQL] Convert seconds to Day hour : min : sec

Thursday, 2 July, 2009 Leave a comment
variable vSec number;
exec :vSec := 68400;
SELECT
to_char(trunc(:vSec / 60 / 60 / 24), '09') || ' [day]' ||
to_char(trunc(MOD(:vSec / 60 / 60, 24)), '09') ||' [hh24]' ||
to_char(trunc(MOD(:vSec, 3600) / 60), '09') || ' [mi]' ||
to_char(MOD(MOD(:vSec, 3600), 60), '09') || ' [ss]'
FROM dual;
Categories: PL/SQL Tags: , ,