Week number and day

Hello

I'll try to find the week of the month and the day of the week by

Select to_char(sysdate,'w') and to_char(sysdate,'d') of the double that gives me 1 (week) and 2 (day of the week)

sysdate is Jan 05,2009.

For to_char (sysdate, 'w') it takes 1 Jan as the 1st day of the week and so to sysdate Jan 05,2009 it is show week 1.

But you do not have to to_char(sysdate,'d') that the output should be 5

Or, if it appears to_char(sysdate,'d') such as sysdate then 2 Jan 05,2009 should come in 2nd week.

Sorry, it's perhaps a stupid question for you guys but I'm new on this and all my calculations do not go.
Help, please...


Concerning
Sagar

Try user format ISO week 'IW' as

SQL> select to_char(sysdate,'iw') , to_char(sysdate,'d') from dual
  2
SQL> /

TO T
-- -
02 2

SQL> 

Tags: Database

Similar Questions

  • Get the number of month, week and day between 2 dates

    Hi all

    Is it possible to display the number of months, weeks and days between 2 dates? by using only the SQL or PL/SQL...

    Entry:
    Date: October 1, 2010
    Date: October 19, 2010

    I want output like below (assuming starts the week from Monday to Sunday in oracle).

    October 1, 2010-(since it's in the middle of the week)
    October 2, 2010-(since it's in the middle of the week)
    October 3, 2010-(since it's in the middle of the week)
    40. (4 Oct-10 Oct falls into the 40th week of the year)
    41. (11 Oct-17 Oct falls into the 41st week of the year)
    October 18, 2010-(since it's in the middle of the week)
    October 19, 2010-(since it's in the middle of the week)


    Note: If there is a month between the date, the number of the month should be displayed.
    End of the month, the remaining date included with a full week, then the week of the year number should
    displayed. After posting the week, remaining dates should be displayed as it is...


    Appreciate your help...



    Thank you.
    Fox.

    You mean something like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  WITH t AS (select date '2010-09-27' as fdate, date '2010-11-21' as tdate from dual)
      2  --
      3  -- END OF TEST DATA
      4  --
      5  select dt2
      6  from (
      7        select dt,
      8               case when days_of_mn = days_in_month then 'Whole: '||to_char(dt,'Month')
      9                    when days_of_wk = 7 then 'Week: '||to_char(dt,'fmWW')
     10               else to_char(dt, 'DD-fmMonth-YYYY')
     11               end as dt2
     12              ,row_number() over (partition by
     13                 case when days_of_mn = days_in_month then to_char(dt,'Month')
     14                                  when days_of_wk = 7 then 'Week: '||to_char(dt,'fmWW')
     15                 else to_char(dt, 'DD-fmMonth-YYYY')
     16                 end order by dt) as rn
     17        from (
     18              select dt, wk, mn, days_in_month
     19                    ,count(*) over (partition by wk) as days_of_wk
     20                    ,count(*) over (partition by mn) as days_of_mn
     21              from (
     22                    select fdate+rownum-1 as dt
     23                          ,to_number(to_char(fdate+rownum-1,'fmWW')) as wk
     24                          ,to_number(to_char(fdate+rownum-1,'fmMM')) as mn
     25                          ,to_number(to_char(last_day(fdate+rownum-1),'fmDD')) as days_in_month
     26                    from t
     27                          connect by rownum <= tdate-fdate+1
     28                   )
     29             )
     30        ) x
     31  where rn = 1
     32* order by dt
    SQL> /
    
    DT2
    -----------------
    27-September-2010
    28-September-2010
    29-September-2010
    30-September-2010
    Whole: October
    Week: 44
    Week: 45
    Week: 46
    19-November-2010
    20-November-2010
    21-November-2010
    
    11 rows selected.
    
    SQL>
    
  • How to calculate the number of days/weeks/months between 2 dates?

    Hello

    I would like to know how to calculate the number of days/weeks/months between 2 dates in OBIEE 11 g, for example, I have 26/05/2013 and 19/05/2013, then I want to get 7 days.

    Thank you!
    Jamie

    Hi Jamie,

    Through this links...

    http://www.bravesoft.com/blog/?p=682
    http://twobiee.blogspot.in/2012/01/working-with-date-differences.html

    Mark as correct it allows u...
    Thank you...

  • Add the number of days of the week to date

    Currently I have the following in place, formcalc code which adds a number of days (based on a calculation different field "TotalDays") on a date, but would like for the calculation of the new date to include only during the week.

    Is there a way to do this?

    var begindate = Date2Num (xfa.resolveNode ("SecB\. Date\.4'), "YYYY-MM-DD")

    $= Num2Date (begindate + TotalDays, "YYYY-MM-DD")

    Thank you.

    Hello

    Here is an example which will add figures given from Monday to Friday at your selected date excluding Saturday and Sunday.

    var dp = "MM/DD/YYYY" ; date pattern
    var d = Date2Num($.formattedValue, dp) ; selected date to number
    var p = 9 ; Number of days to add to the selected date
    
    for i = 1 upto p do
              d = d + 1
              while (Num2Date(d, "e") eq 6 or Num2Date(d, "e") eq 7) do
                        d = d + 1
              endwhile
    endfor
    
    DateField2.formattedValue = Num2Date(d, dp)
    
  • I called Amazon to try to recover the serial number of my old iPod classic two weeks ago, and they gave me a kind of account; They pronounce it account 'seen - It '.

    I called Amazon to try to recover the serial number of my old iPod classic two weeks ago, and they gave me a kind of account; They pronounce it account 'seen - It '. I don't have to ask how, because I thought I knew, but I was wrong. Would what type of account be? And how it's spelled? The name of the account is a tiny s followed a 7-digit number. (Of course I will not type the numbers.)

    I would go to a forum for Amazon, because they can be better equipped to answer a question on their system. If synchronize you the device with iTunes, the number can be there in the backup section.  Find the serial number of your Apple - Apple Support product

  • Gets the number of records in the report based on the input of the user on the date and the number of days.

    Hello

    I need where there are quick dashboard that selects the date, second interval column consists of >, <, = and the third column is seen number (in days)

    for example, the user enters: 12 18, 2015, <, 9. here I report who should get the data (records) 9 days earlier from the date specified (from 12/10/2015 to 18/12/2015).

    Similarly for > =.

    How to get there. I'm unable to write the script and I use the column date in my report. Ask that you please advice how to solve this problem.

    Please find below the screen for reference.

    timediff.jpg

    Kind regards

    Chandra Khalil.

    Hello

    Not exactly why you're doing the report this way. If the user must select, basically, a period of dates, would not easier to have a column of data with a between the operator and the user would select 2 dates (upper and lower intervals)?

    In any case, it is possible to achieve what you want to do as a result of your approach. You could use when's CASE and have a more complex filter, but I think that it is better to have a few nested filters where you use the range operator to determine what date filter that you use (see image below)

    Some notes about my filter. First of all, I am making the assumption that the operator is "=", then the number of days specified must be ignored and you just return the data for the selected date. You will notice also that in my filters, I got a cast so far, but if you are using a column that is already a timestamp so it won't be necessary.

    This should achieve what you want.

    See you soon,.

    Pedro

  • Activation card 6 Lightroom don't has not given me a serial number and it is stuck on 30-day trial

    I recently bought the 6 Lightroom $205 activation card. I went to the www.adobe.com/go/getserial and put the activation code in. Then he said (I don't have a serial number and the license would be activated once I registered"then downloaded and is in the 30 day trial and if I try to activate the license it requires a serial number!) Also, I don't have all my products registered under 'display '. I do not know how to activate it then, and I certainly don't want to pay $205 for a 30 day trial!

    Can someone please help!

    MICAH

    Double-check that you have purchased.  It sounds like it could be a 1 year subscription that is not prudent to purchase (because you can get a 1 year subscription to adobe for lr and ps for $120 us.).

  • Get the number of days in a month based on the month and year of fields

    I have a column in my form which lists the days in a month. I want to configure a hidden field that calculates the total number of days in a month, based on the month and year of the field inputs. The number of days will determine what appears on the column. For example, if I put 4 months, and 2016 in the field of the year, I get 30 in the hidden field. Thus, on the column 'Day', I'll have numbers 1-30. Or if I put 2 months and 2016 in the field of the year, I get the 29 in the hidden field. If the numbers 1-29 appears in the column 'day '.

    Found this on some forum javascript code:

    //Month is 1 based
    function daysInMonth(month,year) {
      
    return new Date(year, month, 0).getDate();
    }

    //July
    daysInMonth
    (7,2009); //31
    //February
    daysInMonth
    (2,2009); //28
    daysInMonth
    (2,2008); //29

    I do not know how to convert this code in JavaScript to adobe and don't really know how to use it. All I know how to do is to configure the field values for the field month and year as variables. I am a novice programmer and would appreciate it really all the help I can get. Thank you in advance!

    The code seems to be JavaScript and runs as needed by using the JavaScript console.

    I would like to consider making more general code, so if you have a date string that includes at least the month and year we could just call the function and get the number of days for that month.

    The following script will calculate the number of days in a month, by using at least the month and year values can display the result on the JavaScript console and all of the value field for the field that has this code as the custom calculation Script.

    function daysInMonth (oDate) {}
    return new Date (oDate.getFullYear (), oDate.getMonth () + 1, 0) .getDate ();
    }

    nMonth var = this.getField("Month").valueAsString; get the value of month;
    nYear var = this.getField("Year").valueAsString; get the value of the year;

    Event.Value = "";

    If (nMonth! = "" & nYear!) = "") {}
    var MyDate = util.scand ("' / mm/yyyy ', nMonth +" / "+ nYear); convert to date object;
    var nDaysInMonth = daysInMonth (MyDate); get the number of days;

    Console.Open (); Open the JavaScript console;

    Console.clear(); clear the console;

    Console.println ("Days in" + nMonth + ":" + nDaysInMonth); show days in month;

    Event.Value = nDaysInMonth; Set the value of the field;

    }

  • Hello. I bought Lightroom, paid license 1 year view, did not have serial. E number and then past the 30 day trial and may not use the product or work more hard. I paid has been deducted from my credit card. How I'm going to work now?

    Hello. I bought Lightroom, paid license 1 year view, did not have serial. And number and then past the 30 day trial and may not use the product or work more hard. I paid has been deducted from my credit card. How I'm going to work now?

    Hi Sergior96769872,

    I saw your Adobe ID (email address), you used to post on the forums, and I see an active subscription on it.

    Please see Help below links: { make sure you use the same Adobe ID (email address) that you used to purchase the subscription }

    Connect and disconnect activate Cloud Creative applications

    Adobe Creative Cloud apps back in test mode after 2015 set CC to update

    * NOTE: Make sure that your firewall of your computer or security software firewall does not block Adobe, if you are not sure of it can just disable the firewall for a while and then log off and log on creative application of cloud and check.

    If it still gives you an error of the trial, then please refer to the troubleshooting listed below:

    If you are using MAC:

    1-force Quit the sub process in the same sequence as shown below from Activity Monitor: see, use the monitor activity on your Mac - Apple Support

    • Creative cloud
    • Basic timing & sync to basic support
    • CC library & process CCX
    • Adobe Common Desktop
    • Adobe update daemon
    • Broker CIB Adobe
    • After that, everything that said adobe on it do a force quit for her

    2 - right click on the Finder icon, then select the "Go - To" folder. You will get a text box, type in the following command and then press the 'return '. ("Not to be missed ~ symbol")

    ~/Library (it will open the folder of the user's library.)

    3. browse to the Application Support > Adobe > trash OOBE folder and folder AAM Updater

    4 - CUT any installed security software with firewall system.

    5 - go to: Apple icon > system preferences > Security & Privacy > General > "allow applications downloaded on" change this anywhere (to make these changes click the padlock in the corner at the bottom left of this window and enter your computer password)

    These changes are temporary you can restore these changes back to normal once your creative cloud app is running *.

    6 - restart the cloud creative app and connect


    If you use the WINDOW:

    1 complete the process / Task Manager tasks in the same order, as mentioned below the Manager tasks. See, Open the Task Manager

    • Creative cloud
    • Basic timing & sync to basic support
    • CC library & process CCX
    • Adobe Common Desktop
    • Adobe update daemon
    • Broker CIB Adobe
    • After that, everything that said adobe on it do a force quit for her

    2 - C:\Users\\AppData\Local\Adobe\ MAA UPDATER and two OOBE (App data & Program Data is hidden folder please see, Show files and folders hidden in Windows 7, 8.x, 10, or Vista)

    3 - CUT any security software installed with firewall system, also if your having any browser Add On installed for blocking advertising that turn off too.

    These changes are temporary you can restore these changes back to normal once your creative cloud app is running *.

    4 - raise the cloud creative app and connect

    Let us know if that helps.

  • 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;

  • I'm on PC Win 7 and bought, downloaded and installed Lightroom 6 the day it was released. When he downloaded and installed it seems to be the version CC, not the LR6. I entered my license number and it works on my computer, but it has Adobe CC

    I'm on PC Win 7 and bought, downloaded and installed Lightroom 6 the day it was released. When he downloaded and installed it seems to be the version CC, not the LR6. I entered my license number and it works on my computer, but there CC Adobe on my desk and I don't want that on my computer. How can I remove the Adobe CC from my computer and still have 6 installed Lightroom and working?

    If you are unable to remove Adobe Creative cloud Control Panel, see link below:

    https://forums.Adobe.com/thread/1846925

  • Hi all, I have 5 LR I purchased with a serial number and a week ago I got the message about a new update, I want to get LR 6 but not the creative cloud, LR4 LR5 to last time it was just an update without having to buy the creative cloud ,

    Hi all, I have 5 LR I purchased with a serial number and a week ago I got the message about a new update, I want to get LR 6 but not the creative cloud, LR4 LR5 to last time it was just an update without having to buy the creative cloud is it possible to LR5 LR6 to? Thank you very much.

    Jeffrey

    Yes, you can buy Lightroom without subscribing to Adobe Creative Cloud.

    To purchase an upgrade to Lightroom 6 from a previous version, please see this link: products .  Scroll to lightroom and click 'buy '. Then click on the selectable text next to "I want to:" and select "upgrade". In the drop-down list, select the version that you are upgrading.  I hope that help.

    Best regards

    Guinot

  • How to generate date thru sysdate and day of the week

    Hello world!

    Please give me a hand with this:

    I need calculate a date thru sysdate and day of the week.

    For example:

    SYSDATE: 22/08/2013

    DAY: TUESDAY

    Result: 27/08/2013 (the date for Tuesday next from today ' hui).

    Another example:

    SYSDATE: 22/08/2013

    DAY: FRIDAY

    Result: 23/08/2013 (the date for Friday next today).

    My version of oracle's 8i (I work with a legacy database).

    Thanks in advance! ... and sorry for my English

    Search the NEXT_DAY function it does exactly what you want

  • Get the number of days, months and year

    Hi all

    I'm using OBIEE 11 g. I have a line of dash for year (2010, 2011, etc.) and months (Jan, Feb,..., Dec). How can I get the number of days in a given month and year in my report?

    For example, if I choose to Jan & 2011, I'd get 31 and 356. And if I choose Feb & 2011, I would get 28 and 356.

    Thank you!

    I have something more good option here... Try to use this

    DAYOFMONTH (TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (CURRENT_DATE) *-1, TIMESTAMPADD (SQL_TSI_MONTH, 1, CURRENT_DATE)))

    This will give you the days for the month in progress (Oct 2011) after calculating the last day of each month... Similary dynamically pass the value Date or month... You will need to modify this function but shud be simple. Hope this helps :)

  • Added two Dates and number of days

    Hello

    I design a page that will calculate a calendar start with a the end calendar date and give me the total number of DAYS between them.

    I tried many pages of formcalc and javascript but you do not find a solution. I bet it's simple and would appreciate the help.

    Thank you

    Hello

    You can use this script Date2Num (to.rawValue, "YYYY-MM-DD") - Date2Num (from.rawValue, "YYYY-MM-DD")

    Attached example.

    BR

Maybe you are looking for

  • NetBook Toshiba NB505 - reading Film HD

    Hello I have a Toshiba NB505 Netbook and I think I do something wrong, or our netbook isn't in it. While trying to play HD/BR movies on our off netbook a file on VLC media player, it plays all nervous and pixelated. Simply very bad as you can't see w

  • backup external hard drive does not not to 8.1

    Updated to 8.1 and now my external Iomega hard drive (for weekly backup) now does not work. He appears in the "devices", but then backup will not recognize it as a valid to continue my backup option. Suggestions please?

  • Change of TRAINING camp opened last Date.

    When I get my bootcamp partition info, I opened last: January 1, 1970... which is not true. How can I set the date with some commands. I tried to access the files and change the date, but it remains the same. command 'touch' and 'then' command do not

  • How can I force tray 2 on 8600 premium automatic selection mode

    When I work with a program that uses the letter and legal communication auto select paper mode by default always to Tray 1 even if the driver acknowledges that the paper is legal and tray 2 is designated as legal.  The printer by default always Tray

  • the extended warranty computer hp laptop

    I want to thank my laptop warranty: details are given below-hp pavi billion laptop 15 - e024tu purchase date 27/10/2013