| Author |
Message |
   
Khaleja
Junior Artist Username: Khaleja
Post Number: 886 Registered: 09-2009 Posted From: 72.129.47.227
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:56 pm: |
    |
Humpty_dumpty:
solution is we maintain these rules in a table (for the users its Oracle list of values) in the coding side..I have a basic date that is po creation date from which I can get the year that I need to calculate these values...based on that I can derive these variables dates for that year for these rules. say for example, if I see the month as 5, and FIRST monday as the rule, I know the year..I can use the command with next_day and get the date..similarly last monday can be obtained by last_date..3rd monday can be obtained by giving next_day(next_day(next_day...) I got the solution. Thanks all for your help  |
   
Khaleja
Junior Artist Username: Khaleja
Post Number: 885 Registered: 09-2009 Posted From: 72.129.47.227
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:51 pm: |
    |
Rediff:
thats correct rediff bhayya..its working...similar ga 2nd, 3rd anedi kanukkovali ante NEXT_DAY command anni sarlu use chesthe saripothundi  |
   
Twitter
Side Hero Username: Twitter
Post Number: 8929 Registered: 10-2009 Posted From: 74.90.15.60
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:50 pm: |
    |
Khaleja:memorial day is the LAST monday of May, Labor day is the FIRST monday of September etc..so alanti vatiki dates kani pettali for a given year..
to_char ((datetimestamp, 'MM DD YYYY'), 'W')= 1 |
   
Humpty_dumpty
Moderator Username: Humpty_dumpty
Post Number: 14104 Registered: 02-2009
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:47 pm: |
    |
Khaleja:
dates and actual days are variable...so there is no absolute std solution IMO one way is to have a custom set of days (user configurable) and have ur calculations exclude these ppl who interact with clients can keep track of updating these |
   
Khaleja
Junior Artist Username: Khaleja
Post Number: 884 Registered: 09-2009 Posted From: 72.129.47.227
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:47 pm: |
    |
SQL> -- Finding the first Monday in the month of September. SQL> SELECT TO_CHAR(NEXT_DAY('01-SEP-97','Monday'),'MM/DD/YYYY HH:MM:SS AM') "Next_Day" from DUAL; similar ga 2nd, 3rd, fouth anedi elago chodali.. |
   
Rediff
Junior Artist Username: Rediff
Post Number: 9 Registered: 12-2006 Posted From: 198.246.249.35
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:46 pm: |
    |
Following gives - last monday of this month select next_day((last_day(to_date('05/2011','MM/YYYY')) - 7), 'Monday') AS day FROM dual; last_day of May 2011 = 5/31/2011 7 days prior to last day = 5/25/2011 first monday since 7 days prior to last day = 5/30/2011 |
   
Khaleja
Junior Artist Username: Khaleja
Post Number: 883 Registered: 09-2009 Posted From: 72.129.47.227
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:36 pm: |
    |
I need to find out all the dates of the holidays for a given year as the dates are variable for these holidays..say for example memorial day is the LAST monday of May, Labor day is the FIRST monday of September etc..so alanti vatiki dates kani pettali for a given year.. |
   
Khaleja
Junior Artist Username: Khaleja
Post Number: 882 Registered: 09-2009 Posted From: 72.129.47.227
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:34 pm: |
    |
Life_sucks:
Aha:
yaa..meeru cheppindi correct..aa command work ayyindi. select to_char(to_date('05/08/2011', 'mm/dd/yyyy'), 'd') from dual 0 = saturday 1 = sunday 2 = monday . . . so if the value is 0 or 1 then I can say that is weekend. inka rule ni batti. I mean in the 5th month LAST monday of a given year anedi ee date anedi ela anedi chodali |
   
Aha
Junior Artist Username: Aha
Post Number: 9 Registered: 01-2011 Posted From: 68.108.79.25
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:24 pm: |
    |
select to_char(to_date('10-MAY-2010'),'day') from dual; should return the day of the date |
   
Life_sucks
Side Hero Username: Life_sucks
Post Number: 2494 Registered: 05-2008 Posted From: 148.168.40.4
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:21 pm: |
    |
first daniki select to_char(sysdate, 'DAY') from dual; |
   
Diwakaram_april1
Side Hero Username: Diwakaram_april1
Post Number: 7900 Registered: 12-2007 Posted From: 75.103.13.52
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:18 pm: |
    |
JAVA lo simple, must n shud ga PL/SQL answer ante thelidhu. |
   
Khaleja
Junior Artist Username: Khaleja
Post Number: 881 Registered: 09-2009 Posted From: 72.129.47.227
Rating: N/A Votes: 0 (Vote!) | | Posted on Tuesday, May 10, 2011 - 06:16 pm: |
    |
Given a date, can we find out if that is a saturday or sunday? Also, how to find the date based on some rule. For eg: find the memorial day in 2011. Memorial day comes as the LAST Monday in Month May. How to find the date if based on Last monday in 5th month? |