Date of the week

Hi,
Does anybody has a sample or suggestions on how to get the day of the week form a date for example if I have a date String of 8/28/2006 the day of the week should be Monday
Thanks

If u r getting this field from the database then u can use a function (I use PoatgreSql, there i use to_timestamp() function ) to convert that string to date and then use another function (here its to_char('timestamp value', 'DAY')) to get the day.
Regards,
Gaurav Goel.

Similar Messages

  • How do I change the start date for the week from Monday to Sunday on my iPhone 5?

    How do I change the start date for the week on iCal from Monday to Sunday on my iPhone5?

    Yes. On my new iPhone 5 the iCal week begins on a Monday not a Sunday and does not give me the option to edit in settings on the phone

  • Getting the start  and end dates of the week

    Hi,
    I was stuck with a problem in getting the start date and end date of the week,i know the month ,week and year also,with these three values how can i get the start and end dates of a week.please help me
    Thanks

    There is no simple way. It has to be a math calculation.
    There are several ways you can get the dates. First you have to know what day is January 1st and what day is december 31st for a particular year. Second you have to check whether the given year is a leap year or not. Based on the abvove information you should be able to find out what day is a particular date.
    Hope this helps to get you started.
    - Venkat Dhurjati.

  • Adding a summary column in a table which contains the start and end dates in the week

    Hi,
    I've got a DIMENSION DATE table and want to add in another column which shows the start and end date of the week.
    See below, the new column is WEEKOFYEARTEXT.
    Does anybody know how i may generate this column using SQL and using the existing columns?
    Umar Javed

    See:  http://www.sqlusa.com/bestpractices/datetimeconversion/
    DECLARE @Year INT = '2015';
    WITH cteDays AS (SELECT DayOfYear=Dateadd(dd, number,
    CONVERT(DATE, CONVERT(char(4),@Year)+'0101'))
    FROM master.dbo.spt_values WHERE type='P'),
    CTE AS (SELECT DayOfYear, WeekOfYear=DATEPART(week,DayOfYear)
    FROM cteDays WHERE YEAR(DayOfYear)= @YEAR)
    SELECT WeekOfYear, StartOfWeek=MIN(DayOfYear), EndOfWeek=MAX(DayOfYear)
    FROM CTE GROUP BY WeekOfYear ORDER BY WeekOfYear;
    WeekOfYear StartOfWeek EndOfWeek
    1 2015-01-01 2015-01-03
    2 2015-01-04 2015-01-10
    3 2015-01-11 2015-01-17
    4 2015-01-18 2015-01-24
    5 2015-01-25 2015-01-31
    6 2015-02-01 2015-02-07
    7 2015-02-08 2015-02-14
    8 2015-02-15 2015-02-21
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • How to get last date of the week

    hi,
    how to get last date of the week like FM WEEK_GET_FIRST_DAY gives the date of the first day of the week i need the date of the last day of the week..
    thnx

    data : p_week type KWEEK,
    p_Date type SYDATUM.
    p_week = <incoming value in week of year>
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
    EXPORTING
    week = p_week
    IMPORTING
    DATE = p_date
    EXCEPTIONS
    WEEK_INVALID = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    To get the last day of the week.
    p_date = p_date + 6.
    You can find the available fm in the system from se37 transaction code.

  • How to calculate start date of the week based on week number ?

    i need to get week number of the current date and based on that i need to calculate start date falling in the same week for last year.
    Eg. today is 31st week of year and 31st july date. so what will be the date on the 31st week of last year. i need the start date of that week.
    we can calculate the week number by select to_char(sysdate,'ww') from dual.
    DO we have a single line query for that or will it require writing a pl/sql block ?

    you can try following query
    it can be as inline but for more clean look and create it as select with include select
    with t as
    (select sysdate as dt from dual)
    select to_char(prev_year_dt - to_char(prev_year_dt, 'D') + 1, 'DD.MM.YYYY') as start_of_week from (select
    -- get day from prev year with the same week number
        case
               when to_number(to_char(add_months(dt, -12), 'WW')) > to_number(to_char(dt, 'WW')) then
                dt - (to_number(to_char(add_months(dt, -12), 'WW')) - to_number(to_char(dt, 'WW'))) * 7
               when to_number(to_char(add_months(dt, -12), 'WW')) < to_number(to_char(dt, 'WW')) then
                dt + (to_number(to_char(dt, 'WW')) - to_number(to_char(add_months(dt, -12), 'WW'))) * 7
               else
                add_months(dt, -12)
           end as prev_year_dt
      from t) t1good luck
    Sergii
    'Monday' is not first day of week in 100% ;)
    Edited by: Galbarad on Jul 30, 2012 11:00 PM

  • RRI : Passing the dates of the weeks

    Hi All,
    I have 2 queries and there is a jump from one query to another.
    In query 1 I have to display result for 4 weeks in a month (Week 1, Week 2, Week 3, Week 4) for the current year and prior year. And from this query I have a jump to Prior Year, where I have to show data only for the week i select. But here the problem I am having is when I click on the header for ex:- "Week 2", I get all the data I have in that cube. On the other hand if I make a jump to query 2 selecting the cell for current year & week 2, I get only the data for 2007(current year) and nothing displays in the prior year  column.
    Please suggest me ways in which I can display only the weeks data exactly.
    Thanks & Regards,
    Max.

    In my page one i have one multiselect list. I have to send the value to this multiselect list to my another page. I have created same name item in both the pages and through branch and passing the addess of page 1 to page 2. But the last selected data is comig in the page 2. I need all the values of page 1 should come in page 2.Once page 1 is submitted and the values are in session state they can just as easily be referenced in page 2 as they can in page 1, so the source of the page 2 value can reference the page 1 value. If the value is not displayed on page 2 then there is the option of not duplicating it all&mdash;just reference the page 1 value.
    As stated above, multiselect list values are separated using ":"s and can't be passed via the URL. If the value has to be passed in a branch then using the *save state before branching* option in the branch avoids this restriction.

  • RPD Variable Required : First day/date of the week

    Hi All,
    Under a requirement I need to create a repository variable which would show the first day of everyweek. That is, I need to show monday's date for every week.
    Could you please let me know how that can be done.
    Thanks,
    Ronny

    Hi,
    under a variable you can hold only a value, not a set of values...(eg. First day of week from this week or next week, not all weeks)
    What is your exact requirement? Can it be achieved with filter on DAYOFWEEK(Time.Day) = 2?
    Regards
    Nicolae

  • Find first & last day of the week from given date

    Hi All,
    I have the below input query,
    WITH TEM AS   ( SELECT '11-JAN-13' DT from dual union   SELECT '16-JUN-12' from dual union   SELECT '04-JUL-12' from dual union   SELECT '09-JAN-13' from dual union   SELECT '10-JAN-13' from dual union   SELECT '04-JAN-13' from dual union   SELECT '07-JAN-13' from dual union   SELECT '04-JUN-13' from dual union   SELECT '08-JAN-13' from dual )  SELECT TO_DATE(DT) D1,'WEEK '||TO_CHAR(TO_DATE(DT),'IW-YYYY') WK from tem;
    I would like to get the below output i.e. Starting date of the week(Saturday) & end date of the week(Friday)
    DT
    WEEK Period
    Max Date in this week
    Min Date in this week
    16-Jun-12
    WEEK 24-2012
    16-Jun-12
    22-Jun-12
    04-Jul-12
    WEEK 27-2012
    30-Jun-12
    06-Jul-12
    04-Jan-13
    WEEK 01-2013
    04-Jan-13
    29-Dec-12
    07-Jan-13
    WEEK 02-2013
    05-Jan-13
    11-Jan-13
    08-Jan-13
    WEEK 02-2013
    05-Jan-13
    11-Jan-13
    09-Jan-13
    WEEK 02-2013
    05-Jan-13
    11-Jan-13
    10-Jan-13
    WEEK 02-2013
    05-Jan-13
    11-Jan-13
    11-Jan-13
    WEEK 02-2013
    05-Jan-13
    11-Jan-13
    04-Jun-13
    WEEK 23-2013
    01-Jun-13
    07-Jun-13
    Also suggest if any function available in oracle for this one.

    Like this? I think in your required output, 3rd row data, MAX_DATE should be 29-DEC-12 and MIN_DATE should be 04-JAN-13.
    WITH TEM AS 
    ( SELECT '11-JAN-13' DT from dual union 
    SELECT '16-JUN-12' from dual union
    SELECT '04-JUL-12' from dual union
    SELECT '09-JAN-13' from dual union
    SELECT '10-JAN-13' from dual union 
    SELECT '04-JAN-13' from dual union
    SELECT '07-JAN-13' from dual union
    SELECT '04-JUN-13' from dual union
    SELECT '08-JAN-13' from dual )
    SELECT D1 DT,
           WK WEEK_PERIOD,
           CASE WHEN (TRIM(TO_CHAR(D1,'DAY'))='SATURDAY') THEN D1
                 ELSE NEXT_DAY(D1,'SATURDAY')-7
            END AS MAX_DATE_IN_THIS_WEEK,
          CASE WHEN (TRIM(TO_CHAR(D1,'DAY'))='FRIDAY') THEN D1
                ELSE NEXT_DAY(D1,'FRIDAY') END AS MIN_DATE_IN_THIS_WEEK
    FROM (
    SELECT TO_DATE(DT) D1,'WEEK '||TO_CHAR(TO_DATE(DT),'IW-YYYY') WK from tem)
    ORDER BY DT;
    OUTPUT:
    DT        WEEK_PERIOD  MAX_DATE_ MIN_DATE_
    16-JUN-12 WEEK 24-2012 16-JUN-12 22-JUN-12
    04-JUL-12 WEEK 27-2012 30-JUN-12 06-JUL-12
    04-JAN-13 WEEK 01-2013 29-DEC-12 04-JAN-13
    07-JAN-13 WEEK 02-2013 05-JAN-13 11-JAN-13
    08-JAN-13 WEEK 02-2013 05-JAN-13 11-JAN-13
    09-JAN-13 WEEK 02-2013 05-JAN-13 11-JAN-13
    10-JAN-13 WEEK 02-2013 05-JAN-13 11-JAN-13
    11-JAN-13 WEEK 02-2013 05-JAN-13 11-JAN-13
    04-JUN-13 WEEK 23-2013 01-JUN-13 07-JUN-13
    9 rows selected.

  • How to get the date for the last day of a week?

    Is there a easy way to get the date for the last day of week?
    eg a week starts on monday and end on sunday
    January 11, 2005 is the start date for the week
    January 17, 2005 is the end date for the week
    or
    say
    February 26, 2003 is the start date for the week
    March 5, 2003 is the end date for the week
    I just need a simple way of figuring that out....
    I figured out how to get the start date for the week but just can't get the latter..
    formatting of the date is not of a concern.. that I know how to do
    thanks in advance

    How about something like the following?
         Calendar someDay = new GregorianCalendar(2005,0,11);//2005 Jan, 11
         //Note above that January is 0, not 1, as counting starts from 0.
          someDay.add(Calendar.DAY_OF_MONTH,6); //add 6 days
         java.util.Date  lastDayOfWeek = someDay.getTime();
         //If someDay was the start of a week, lastDayOfWeek should now be
         //the last day of that week.
         System.out.println(lastDayOfWeek.toString() );

  • Get the first and the last date of a week

    Hi all
    I need to get the first and the last date of a specific week.
    I need a function that returns two date passing it just one date.
    The function has to calculate the first and the last date of the week of the argument date.
    hope to be clear
    regards

    goiters,
    I need to get the first and the last date of a specific week.Yup, and what's the first day of the week in your part of the world, is it Sunday or Monday?
    I need a function that returns two date passing it just one date.No you don't, just add 7 days to the start of the week.
    hope to be clearWell, you can hope.
    Keith.
    Message was edited by: corlettk - now I hope to clear ;-)

  • Get the week's start date

    How to get back the corresponding date according to 'ISO standard' while giving the week number and year as input. For example, Week=2 and year=2009, then result needed is 5-Jan-2009. Any function to achieve this?

    <cffunction name="getStartDateFromWeekNumber" hint="returns start date of the week, given the week number and the year">
        <cfargument name="weekno" required="yes">
        <cfargument name="year" required="yes">
        <cfset var startDate = dateAdd("w",arguments.weekno,createdate(arguments.year,1,1))>
        <cfreturn startDate>
    </cffunction>
    <cfset startDate = getStartDateFromWeekNumber(2,2009)>
    <cfset startDate_formatted = dateFormat(startDate, "dd-mmm-yyyy")>
    <cfoutput>#startDate_formatted#</cfoutput>

  • Days of the week

    Somewhere in my program, I return two Stirngs, which are start-date and end-date of the week.
    For example: (30/06/2003 , 06/07/2003)
    I have a String[7] array and want to assign each element of the array the days. I mean:
    String[0] = 30/06/2003
    String[5] = 05/07/2003
    String[6] = 06/07/2003
    I need a little function like
    public static String[] assignDate(String start, String end) {}
    is it possible to do this, and how?

    How about this:
    Use a for loop and a java.util.GregorianCalendar object.
    Loop 6 times (a start day, then loop once for each subsequent day).
    In the loop body, roll the Calendar forward one day.
    Then get the Date and use a SimpleDateFormat to produce a formatted String.

  • Varying Maintenance Work Center Capacity by Days of the Week

    I had submiited a question a month or so ago about varying the capacity of a maintenance work center depending on the day of the week.  I got an answer and it worked.
    We've set up another work center (in staging) for the same scenario (the work center is half staffed on Fridays).  Monday through Thursday the capacity is 36 hours, Friday the capacity is 18 hours, the validity from date is 04/05/2010.  When we use CM34 to do some scheduling though, the capacity shown is 40 hours a day, Monday through Friday which is what the capacity was set up for prior to the validity from date.  It's also the same capacity as shown in the 'Standard Available Capacity' section.
    I looked back at the work center I had modified previously and it's showing the same thing.  It's like it's ignoring the validity dates.
    Any ideas?
    David Macindoe

    David,
      I know for sure that this is reflected in the standard profile for Capacity Availability check as part of release of the order (SAPSFCG013). The Availability for the week does show the capacity for the interval dates of the week and not the standard available capacity.
      I haven't checked this on CM24 and if the standard profiles don't reflect the change then the profile probably needs to be changed.I need to look into it to make sure. In the meantime if you aren't able to resolve the same, i would suggest to raise a note and see where that leads you.
    Regards
    Narasimhan

  • Date find from week of year.

    Hi all,
    I have week number values of the year, ie values are ranging from 1-52.
    i want to find out start and end dates of the week. do we have any functions provided by oracle to achieve this.
    Please help me.

    date find from year of week.

Maybe you are looking for

  • My skype to go number does not take incoming calls

    No matter what phone you call from (U.S. landline, various cell carriers, U.K.) you get a message "You have reached a non-working number.  Announcement: 14 Switch 1, 8 dash 3." I have plenty of credit in my account, and can make outgoing calls. But n

  • PO PRICES PICKED AS DEFAULT FROM

    Sir, Ply help me in the following Setting done for Picking Prices in PO. I want to know whether while making PO prices are picked from inforecord or from last po. where can i find these setting. regards amey

  • Why does the Browse to OPC item.vi example not work in Labview 6.0?

    I was trying to update my application from Labview 5.1.1 to Labview 6.0, I could not be able to use the DataSocket Vis. Then I opened the example "Browse to OPC item.vi" in Communication examples in Labview 6.0, the Vi was not able to browse the OPC

  • [svn:fx-trunk] 12903: Fix for regression in BitmapUtil.getSnapshot().

    Revision: 12903 Revision: 12903 Author:   [email protected] Date:     2009-12-14 07:53:53 -0800 (Mon, 14 Dec 2009) Log Message: Fix for regression in BitmapUtil.getSnapshot(). The fix last week (for sdk-20250) compensated for larger bounds with text

  • Where can I download Tuxedo 10.3 files from?

    Where can I download Tuxedo 10.3 files from? The OTN download page only has Tuxedo 11 and 12.