get the day of the week: Monday, Tuesday...

Hello
Is there a system function to get the LUN, sysdate Mar in Oracle:
Or do I have to go with the series of the Ifs after:
Select double to_char(sysdate,'D');


TX
T
SQL> select to_char(sysdate,'FMDay') from dual
  2  /

TO_CHAR(S
---------
Wednesday

SQL> 

SY.

Tags: Database

Similar Questions

  • How to get the second Monday of each month in a given date range?

    In Oracle forms, how to get the second Monday of each month in a given date range?

    I tried below using the query WITH the Clause, but it seems that WITH Clause does not work in Oracle forms. So is there another way to do this in Oracle forms?

    WITH month_range AS

    (

    SELECT TO_DATE ('Dec 2013', 'Mon YYYY') AS first_month

    , TO_DATE ('Mar 2014', 'Mon YYYY') AS last_month

    OF the double

    )

    SELECT NEXT_DAY (6 + ADD_MONTHS (first_month

    , LEVEL - 1

    )

    , 'MONDAY '.

    ) AS second_monday

    OF month_range

    CONNECTION OF LEVEL < = 1 + MONTHS_BETWEEN (last_month, first_month)

    ;

    Thanks in advance.

    Good fishing, when the first day of the month is Thursday... So I changed the query accordingly... Try the below

    SELECT CASE WHEN TO_CHAR (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), 'DY') = 'game '.

    THEN NEXT_DAY (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), 'THU')

    Of OTHER NEXT_DAY (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), 'Game') + 7

    END AS second_day

    FROM (SELECT SYSDATE startdate,

    SYSDATE + 300 enddate

    THE DOUBLE)

    CONNECT BY LEVEL<=>

  • Find the Date day i.e. Monday, Tuesday etc.

    Hello

    I need to know the day of the Date. that is to say Monday, Tuesday etc. This is because if the date falls on Saturday or Sunday it had to impose tariffs of difference and week with normal rates.

    Thank you
    Amol

    We should probably add a function for this that I've certainly seen the prior requirement.

    Fortunately it is quite easy to calculate using a simple rule - the trick is to choose a date in the past which was a Monday, and then use the modulo operator.

    For example:

    The day of the week = (date data - 1980-01-07) modulo 7

    That is to say January 7, 1980 was a Monday, so every 7th day after is also a Monday - combined with the modulo operator, this will give you:
    0 Monday
    1 Tuesday
    ...
    5 Saturday
    6 Sunday

    The only downside is that the dates before 1980-01-07 will give a negative modulo (this differs from the mathematical modulo operator, but must be symmetrical with the whole division operator truncate to zero)-was so before the reference date will give:

    0 Monday
    Tuesday-6
    ...
    -2 Saturday
    -1 Sunday

    You can choose to write the rules to take into account, or choose a reference date so far in the past that it is useless.

    Concerning
    Andrew

  • How to get the week sequence?

    Hi friends,

    Greetings of the day!

    I am greatly in dealing with the next thing.

    I have two tables. a table with all the required information and another table called process_dtl, have the details of refreshment. These tables gets updated once a week. when its gets refreshed have will update the process_dtl table start date and refreshes the end date. There are also a few unique seq_no for each update. I will combine these 2 tables with seq_no process, because it is the unique key in the two tables. About these tables are more 2-year data. But what I want, I want only 6 months given. With 6 months data, based on the start_date I want to have the data week sequence. Means I want to know if it is given 1 week or 2 weeks, etc because the data get updated once a week. Is it possible to distinguish like this using start date. Please reply back if you understand the above.
    I'm using oracle 11g.


    Thank you

    Published by: 981145 on May 8, 2013 04:56

    You can get the data from the last 6 months simply by using the WHERE clause to limit the process_start_dt or process_end_date, as mentioned by Chris above. Since the sequence of steps. is unique for each race, I assume that the data you get from dtap_rpt_site_dtl_hst for that sequence number. needs no other filter criteria, so it must be good there.

    For the format of the week like you wanted, use the following in your select clause-

    to_char(process_start_dt, 'Mon') ||' ' || to_char(process_start_dt, 'D') week_seq
    

    Hope this has helped.
    Thank you!

  • How to get the week of the year in American Standard

    Hello

    I know that it might be a repetitive question, but has not found a convincing solution to him in any of the previous threads. I'm looking for a function (user defined, if someone has already written it) go the week of the year, American Standard. i.e., The week should begin on Sunday and end on Saturday (and NOT from Monday to Sunday)

    03/01/2010 - should be the beginning of the 1st week of 2010... 10/01/2010 will be the beginning of the second week and so on
    04/01/2009 - should be the beginning of the 1st week of 2009... 11/01/2009 will be the beginning of the second week and so on.

    Does anyone have a function that takes a date as input and returns back the week of the year in the above format? Any help is greatly appreciated.

    Thank you

    You can add a day to your date in order to manipulate the weeks;

    with t as (
       select to_date('02/01/2010','dd/mm/yyyy') dt from dual union all
       select to_date('03/01/2010','dd/mm/yyyy') from dual union all
       select to_date('09/01/2010','dd/mm/yyyy') from dual union all
       select to_date('10/01/2010','dd/mm/yyyy') from dual)
    select dt, to_char(dt, 'Day') dy, to_char(dt+1, 'iw') wk
    from t;
    
    DT          DY        WK
    ----------- --------- --
    02/01/2010  Saturday  53
    03/01/2010  Sunday    01
    09/01/2010  Saturday  01
    10/01/2010  Sunday    02
    
  • Get the week number

    How can I get the number of week a week of prasent using simpleDateFormat class?

    With regard to:

    Jitendra.Balla

    GetWeekOfYear DateTimeUtilities (calendar, long date, int firstDayofWeek)

  • How to get the week of the current month

    Hi all
    Is it possible to find the week of the current month.

    Help, please...

    Hello...

    Use this feature to get the desired result.

    Hope it's okay...

    CEILING (DAYOFMONTH ("Time D0". "T00 calendar date") (/ 7.00) "

    Note: use 7.00 7 not only in the denominator*.

  • How to get the first day of the week on the calendar?

    Hello

    I'm storing calendar weeks in my database. for example 30/2013.

    How can I get the first day of this week (Monday)? in this case, it is 22.07.2013

    THX

    Anja

    with your_table as)
    Select 30-2013' double your_column
    )

    Select
    trunc)
    TO_DATE ("0101"
    || (substr (your_column,-4), 'MMDDYYYY'), 'IW')
    + to_number (substr (your_column, 1, 2)) * 7-7
    start_of_week
    from your_table

    START_OF_WEEK
    22/07/2013

    Post edited by: chris227
    Corrected example

  • How to get the last day of the week?

    HII

    I can get the week number of calendar for a given date using

    SELECT to_char (to_date('04/04/2011','MM/DD/YYYY'), 'WW') FROM dual

    can any body tell me, how to get the last day of the week?

    and the answer should be: 04/08/2011(8th april)
    Thank you
    San

    Published by: sandeep9 on April 4, 2011 03:50

    Perhaps this...

    SQL> select trunc(sysdate,'WW')+6 from dual;
    
    TRUNC(SYSDATE,'WW')+
    --------------------
    08-APR-2011 00:00:00
    
    SQL>
    
  • Function to create dates as well as the week, quarter, and year

    Hi all

    I am trying to write a function that will create automatically with their respective week, quarter, and year dates in different columns.

    For example,.

    Date of the quarter Qtr/Yr/QtrWk week exercise exercise exercise

    415 Q4-WK1352201530/09/2015

    I would like to create a full year for each day of show week quarter Qtr/year/QtrWk, exercise, exercise from 01/10/2015-09 30, 2016.

    Appreciate your help and advice.

    Thank you

    AMan

    Hi AMan,

    can't answer your question with a detailed requirement.

    No doubt a whole year can be created in a SQL statement (CONNECT BY or the recursive subquery factoring) and is not a problem.

    But I would like to ask you the following:

    • How do you get the week number? There might be a different way to look at it (ISO or not, week starting with the Sun, Mon or the first day of the year, etc.)
    • The same question can be applied to the financial week. When it's the first week? 01/10/2015 until 10/07/2015?

    You can have a quick glance at the definition of different week in 'Model of Format of Date' on this page:

    https://docs.Oracle.com/CD/B28359_01/server.111/b28286/sql_elements004.htm

    Check the difference between WW and IW.

    Kind regards.

    Alberto

  • SELECT query to Sum (Qty) of the week

    Hi I have a source as a table

    LOCATIONID NOT NULL VARCHAR2 (200) for example:-ABC, ACD etc.
    IPC NOT NULL VARCHAR2 (200) for example:-12345,13245 etc.
    PRODUCTIONDATE NOT NULL VARCHAR2 (200) for example:-20120524,20120524. a the data from 20111124 to 20121030
    VARCHAR2 (2000) quantity for example:-0012365,0012356,0012456 etc.
    PRODUCTIONCODE VARCHAR2 (2000), for example:-AS123, AD154 etc.
    MOULDQUANTITY VARCHAR2 (2000), for example:-00256, 00236etc

    Now this table I want to derive the following satisfying the query.
    need to derive STARTDATE who shopuld be the Monday of the week.
    You will need to calculate QUANTITY should be the total amount of the IPC, the procutioncode and the locationid from the 1st day of the week (Monday) on the last day of the week (Sunday) included.

    How can I do that.
    I am facing problem mainly during the derivation of quantity which may can be derived by force but confised about what should group by. :(
    Can someone / Experts help out me for the construction of this query.

    The Oracle version: - Oracle Database 11g Release 11.2.0.1.0 - 64 bit Production

    Example of source data;
    LOCATIONID CPI PRODUCTIONDATE PRODUCTIONCODE MOULDQUANTITY QUANTITY
    3064 20120521 000000000 FG58E MPL1 0
    3064 20120522 000000000 FG58E MPL1 0
    3064 20120523 000000000 FG58E MPL1 0
    3064 20120524 000000000 FG58E MPL1 0
    3064 20120525 000000000 FG58E MPL1 0
    3064 20120526 000000000 FG58E MPL1 0
    3064 20120527 000000000 FG58E MPL1 0
    3064 20120528 000000000 FG58E MPL1 0
    3064 20120529 000000000 FG58E MPL1 0
    3064 20120530 000000000 FG58E MPL1 0
    3064 20120531 000000000 FG58E MPL1 0
    3064 20120601 000000000 FG58E MPL1 0
    3064 20120602 000000000 FG58E MPL1 0
    3064 20120603 000000000 FG58E MPL1 0
    3064 20120604 000000000 FG58E MPL1 0
    3064 20120605 000000000 FG58E MPL1 0
    3064 20120606 000000000 FG58E MPL1 0
    3064 20120607 000000000 FG58E MPL1 0
    3064 20120608 000000000 FG58E MPL1 0
    3064 20120609 000000000 FG58E MPL1 0
    3064 20120610 000000000 FG58E MPL1 0
    3064 20120611 000000000 FG58E MPL1 0
    3064 20120612 000000000 FG58E MPL1 0
    3064 20120613 000000000 FG58E MPL1 0
    3064 20120614 000000000 FG58E MPL1 0
    3064 20120615 000000000 FG58E MPL1 0
    3064 20120616 000000000 FG58E MPL1 0
    3064 20120617 000000000 FG58E MPL1 0
    3064 20120618 000020100 FG58E MPL1 2
    3064 20120619 000020100 FG58E MPL1 2
    3064 20120620 000018400 FG58E MPL1 2
    3064 20120621 000000000 FG58E MPL1 2
    3064 20120622 000015100 FG58E MPL1 2
    3064 20120623 000020100 FG58E MPL1 2
    3064 20120624 000020100 FG58E MPL1 2
    3064 20120625 000000000 FG58E MPL1 0
    3064 20120626 000000000 FG58E MPL1 0
    3064 20120627 000000000 FG58E MPL1 0
    3064 20120628 000000000 FG58E MPL1 0
    3064 20120629 000000000 FG58E MPL1 0
    3064 20120630 000000000 FG58E MPL1 0
    3064 20120701 000000000 FG58E MPL1 0
    3064 20120702 000032600 FG58E MPL1 4
    3064 20120703 000032600 FG58E MPL1 4
    3064 20120704 000032600 FG58E MPL1 4
    3064 20120705 000032600 FG58E MPL1 4
    3064 20120706 000032600 FG58E MPL1 4
    3064 20120707 000032600 FG58E MPL1 4
    3064 20120708 000032600 FG58E MPL1 4

    Destination of it

    IPCCODE PRODUCTIONCODE WEEKREQUIREMENT STARTDATE
    3064 FG58E 20120521 0
    3064 FG58E 20120528 0
    3064 FG58E 20120604 0
    3064 FG58E 20120611 0
    3064 20120618 1139 FG58E
    3064 FG58E 20120625 0
    3064 20120702 2282 FG58E


    Thank you
    Mahesh

    Published by: MaheshGx on May 24, 2012 14:54
    group by IPC,PRODUCTIONCODE,/*quantity, PRODUCTIONDATE *,/ trunc(to_date(productiondate,'yyyymmdd'),'IW'))
    
    select ipc,
             productioncode,
             productiondate,
             TRUNC (TO_DATE (productiondate, 'yyyymmdd'), 'IW') stdate_iw,
             trunc(to_date(productiondate,'YYYYMMDD'),'D') stdate,
             sum(quantity) over   (partition by  ipc,
                                                 productioncode,
                                                 to_char(to_date(productiondate,'YYYYMMDD'),'YYYY'),
                                                 to_char(to_date(productiondate,'YYYYMMDD'),'WW')
                                                 /* TRUNC (TO_DATE (productiondate, 'yyyymmdd'), 'IW')) */
                                                 )  qty /* sum_week */,
             sum(quantity) over () sum_all
    from (select ipc,
                 productioncode,
                 productiondate,
                 quantity
            from ompproduction
           where trim (locationid) = 'MPL1');
    

    http://SS64.com/ora/syntax-FMT.html

    Check your difinition for

    week trunc(date,'WW') != trunc(date,'IW')
    
  • How can I stop receiving the weekly activity of catalyst report?

    My site is no longer the catalyst for the company, but I get the weekly report again and again. The churn results in an error message. Help someone.

    Hello

    This means that the site of British Colombia is still active and you have not deleted. If in case you want the site of BC and you just want you not receiving weekly reports, you'll need to connect to the admin of the site > my details > and uncheck the option to not receiving weekly reports.

    For more details, you can also find this video useful: bccademy | How to enable / disable the weekly reports. -YouTube

  • get the number of the day of the week - any national locale is used

    Hi all

    My need is to get the number of the day of the week - any national local is used.

    For example, Saturday's 6th day of the week in my country, because the week starts on Monday.

    I heard that some countries start the week of Sunday.

    So my need is to compile code that does not depend on local national.

    How can I make it?

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    "CORE 11.2.0.1.0 Production."

    AMT for Linux: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production

    Hello

    2621671 wrote:

    Hi all

    My need is to get the number of the day of the week - any national local is used.

    For example, Saturday's 6th day of the week in my country, because the week starts on Monday.

    ...

    That's what you asked for, whatever your NLS settings:

    1 + TRUNC (dt) - TRUNC (dt, 'IW')

    If dt is a DATE, TRUNC (dt, 'IW') is the beginning of the ISO week containing dt.  ISO weeks always start on Monday, whatever NLS_TERRITORY, or other NLS parameters.

    I heard that some countries start the week of Sunday.

    So my need is to compile code that does not depend on local national.

    How can I make it?

  • get the number of days of the week to sysdate

    Hi all

    my need is to get the number of the day of the week of sysdate.

    Here's how can I make it right now:

    Select to_char(sysdate,'Dy') t1 double

    But he returns the abbreviated name of the day of the week while I need number of days of the week.

    Please help me. Thanks in advance.

    Best regards

    --

    Marco

    Or if you want the ISO week (Monday = day 1):

    Select trunc (sysdate) - trunc(sysdate,'IW') + 1 double;

  • SQL to get the Monday of each week of IW in one year!

    Hello!

    It's an SOS :) I had to get a request to give me every Monday a week IW in one year. I think that depending on the weeks IW it about 52.1 weeks in a year ago. So, basically, I want the departure on Monday of each week. I then store these values in a variable and use it in APEX as column headings. Online, I've seen a few samples not associated not with that, but where the closure was done using the object. Not sure if this is the right approach.

    The problem is since it is not stored in a table, how can I loop as 52/53 times such that the output every Monday (date format) for a given year. Basically, the output would be 52/53 rows with a date (Monday).

    Help, please!

    Thank you
    Sun

    Published by: ryansun on June 28, 2012 23:09

    It would be something you are looking for?

    SQL> variable yr number
    SQL> exec :yr := 2015
    
    SQL> with dates as (
      2  select to_date('0101'||:yr,'ddmmyyyy')-4+level da
      3    from dual
      4  connect by level < 373
      5  )
      6  select :yr iyyy, to_char(da,'IW') iw, da monday
      7    from dates
      8   where to_char(da,'dyiyyy', 'nls_date_language=american')='mon'||:yr
      9  ;
    
          IYYY IW       MONDAY
    ---------- -------- ----------
          2015 01       29-12-2014
          2015 02       05-01-2015
          2015 03       12-01-2015
          2015 04       19-01-2015
          2015 05       26-01-2015
          2015 06       02-02-2015
          2015 07       09-02-2015
          2015 08       16-02-2015
          2015 09       23-02-2015
          2015 10       02-03-2015
          2015 11       09-03-2015
          2015 12       16-03-2015
          2015 13       23-03-2015
          2015 14       30-03-2015
          2015 15       06-04-2015
          2015 16       13-04-2015
          2015 17       20-04-2015
          2015 18       27-04-2015
          2015 19       04-05-2015
          2015 20       11-05-2015
          2015 21       18-05-2015
          2015 22       25-05-2015
          2015 23       01-06-2015
          2015 24       08-06-2015
          2015 25       15-06-2015
          2015 26       22-06-2015
          2015 27       29-06-2015
          2015 28       06-07-2015
          2015 29       13-07-2015
          2015 30       20-07-2015
          2015 31       27-07-2015
          2015 32       03-08-2015
          2015 33       10-08-2015
          2015 34       17-08-2015
          2015 35       24-08-2015
          2015 36       31-08-2015
          2015 37       07-09-2015
          2015 38       14-09-2015
          2015 39       21-09-2015
          2015 40       28-09-2015
          2015 41       05-10-2015
          2015 42       12-10-2015
          2015 43       19-10-2015
          2015 44       26-10-2015
          2015 45       02-11-2015
          2015 46       09-11-2015
          2015 47       16-11-2015
          2015 48       23-11-2015
          2015 49       30-11-2015
          2015 50       07-12-2015
          2015 51       14-12-2015
          2015 52       21-12-2015
          2015 53       28-12-2015
    
    53 rows selected.
    

Maybe you are looking for

  • Satellite A30 151: motherboard power connector broken

    I have an old toshiba A30-151 that has fallen down a while a go because of the power connector snap into the power socket. This had happened before at the back of the power supply, but I managed to solder back together. Unfortunately it broke again a

  • Liquid Jade S - update, download ask SD card...

    Hello. I have an Acer Liquid Jade S with two SIM cards installed if no SD card space. Yesterday received notification on an Acer system update, when I try to download, it tells me that there is no SD card installed and I need to install a... The inte

  • I click on closing down and then stops just my pc

    It starts with stop and then it stops at this step... https://mysite.uchicago.edu/personal/bsdad_rcarter/Blog/Lists/Photos/112107_1514_ParallelsDe1.png... Please help me!

  • The desktop icon can not find the program

    I'm having a problem where when I click on my desktop icons they can not find the program that is associated with run. Most of them is related to sites Web that I often use, so I select Internet Explorer as the associated program then remember this r

  • move the icons in the notification area of the taskbar

    How can I move the icons to unhidden in the notification area of the taskbar on a Compaq Presario Notebook running Windows 7?