Skip navigation
Contact Us
651 Views 3 Replies Latest reply: Nov 21, 2012 7:33 PM by Felix Ho RSS
Alain CARVALHO Newbie 10 posts since
Jul 17, 2012
Currently Being Moderated

Nov 20, 2012 10:23 AM

Last Workday

Hi all,
How can I write the last workday?
For the actual day there is the function SYSTIMESTAMP but what about the last work day?
Thanks all,
Alain

 

  • Felix Ho Expert 342 posts since
    Aug 23, 2011
    Currently Being Moderated
    Nov 20, 2012 7:01 PM (in response to Alain CARVALHO)
    Last Workday

    Hi Alain,

     

    Do you mean last working day???

     

    If yes, You may need to check the weekday of actual day 1st.

     

    Check weekday Logic:

    If

    Weekday = (Monday to Friday), use actual day,

    If

    Weekday = (Saturday), use actual day - 1 day

    If

    Weekday = (Sunday), use actual day - 2 days

      • Felix Ho Expert 342 posts since
        Aug 23, 2011
        Currently Being Moderated
        Nov 21, 2012 7:33 PM (in response to Alain CARVALHO)
        Last Workday

        The following expressions return the day of the week for each date in a port:

         

        TO_CHAR( DATE_PROMISED, 'D' )

         

        DATE_PROMISED           RETURN VALUE

        04-01-1997 12:00:10AM           '3'

        02-22-1997 01:31:10PM           '7'

        10-24-1997 02:12:30PM           '6'

        NULL                                    NULL

         

        1 = Sunday

        2 = Monday

        3 = Tuesday

        ...

         

        And you have Last_Day function to get the last date of the month.

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points