Thursday, September 7, 2017

CSS: Fixed Header and Footer


footer{
background: #666666;
color: #B2D1D1;
font-weight: bold;
position: fixed;
Width: 100%;
text-align: center;
bottom: 0;
height: 2em;
padding-top: 2em;
}

header{
background: #666666;
color: #B2D1D1;
font-weight: bold;
font-family: voxBOX;
text-align: center;
font-size: 1em;
top: 0;
position: fixed;
Width: 100%;
height: 3em;
padding-top: 1em;
z-index: 1;
box-shadow: 0px 3px 7px #000000;  <--Just to put shadows on your header. Try it! It's cool :)
}

Sample Ouput:
Look at the scrollbar, header and footer didn't moved. :)

Thursday, February 23, 2017

Oracle/PLSQL: Function to get duration in years/months/days/hours/minutes

Below function is ready to use :)
Happy coding... ^^
Note: This should be paste inside the package body.


FUNCTION FUNC_GET_DURATION(VR_FDATE VARCHAR2) RETURN VARCHAR2
  IS
    VR_DURATION VARCHAR2(500);
  BEGIN
  
    SELECT  '~ '
          || TRUNC(MONTH_DIFF/12) || ' years, '
          || TRUNC(MOD(MONTH_DIFF, 12)) || ' months, '
          || TRUNC(31*(MONTH_DIFF - TRUNC(MONTH_DIFF))) || ' days, '
          || TRUNC(24*MOD(VR_TDATE-VR_FDATE,1)) || ' hours, '
          || TRUNC(MOD(MOD(VR_TDATE-VR_FDATE,1)*24,1)*60) || ' minutes'
        INTO VR_DURATION
    FROM (SELECT CAST(TO_TIMESTAMP(VR_FDATE, 'Mon DD, RR HH24:MI:SS') AS DATE) VR_FDATE
                ,SYSDATE VR_TDATE
                ,MONTHS_BETWEEN(SYSDATE,TO_TIMESTAMP(VR_FDATE, 'Mon DD, RR HH24:MI:SS')) as MONTH_DIFF
          FROM DUAL);
          
    RETURN VR_DURATION;
    
  END FUNC_GET_DURATION;


//


Execution:
SELECT PackageName.FUNC_GET_DURATION('JAN 02, 2015 10:00:00 AM');

Output:
~ 2 years, 1 months, 22 days, 2 hours, 56 minutes