Work day of the week of the date of

Hi guys, is a bit common code that allows you to work on the day of the week for a given date? IM pretty new to this and I don't know how to write it and thought since it's probably quite commonly need I may be able to get help here. Thank you.

Day of the week in letters
Select to_char (sysdate, 'day') of double;

Day of week in numbers
Select double to_char(sysdate,'D');

Day of the month in figures
Select to_char (sysdate, 'DD') of double;

Tags: Database

Similar Questions

  • I'm looking for the 1st working day of the week.

    Hello

    I'm looking for the 1st working day of the week except Saturday, Sunday and holidays. I have vacation, the name of the table that contains the columns HolidayDate and HolidayDescription.

    Ex:

    01/10/2011 is monday (i.e) 1st company day.check if it is in the host table, then return the result as 01/11/2011 other returns the output as a 11-1-2011(which is the first business day of this week).


    Can someone tell me the query to solve?

    Hello

    If dt is any DATE, it is the first day of work in the same week as dt:

    WITH     all_week     AS
    (
         SELECT     TRUNC (dt, 'IW') + LEVEL - 1     AS a_dt
         FROM     dual
         CONNECT BY     LEVEL <= 5
    )
    SELECT     MIN (a_dt)     AS first_work_dt
    FROM     all_week
    WHERE     a_dt     NOT IN (
                      SELECT  holiday_dt
                      FROM    holiday
                     )
    ;
    

    This assumes that you have never 5 consecutive days. (Where I work, holidays are always at least a week apart, so that's fine.)
    If you have a week's holiday, increase the number of 'magical' in the CONNECT BY clause.

    It also means that holiday.holiday_dt = TRUNC (holiday.holiday.dt).

  • Disable certain days in the date picker

    Hi, I use Apex 4.2 and want to find a way to disable certain days in the date picker.

    For Ex: I want to turn off Mondays and the days of the week when the date picker popup is shown. And also I want all the previous days from today should be disabled.

    Please let me know how I can do this...

    Thank you

    Hello

    to disable different days look at this site: http://jquerybyexample.blogspot.com/2010/07/disable-specific-days-in-jquery.html

    To deactivate the days in the past, add this in: settings > Minimum Date: + 0d

    See you soon,.

    Tobias

  • get more records of 30 days from the date of the day

    I use MS SQL 2000 How can I recover the data that are older than 30 days from the date of the day? I put currendate "DateTime" field as data type and length is the '8 '.

    < cfset variables.getdate = DateAdd (would be ',-30, now()) >

    Select dataname
    of tabletest
    where currendate > = "variables.getdate."

    the sql stmt above does not work.

    Select dataname
    of tabletest
    where currendate<= #createodbcdate(dateadd("d",="" -30,="">

    You say that you want records which are more than 30 days from now, so that it must be less than or equal to the date
    But if you want the Chronogram of 30 days there are until now then it must be greater than or equal to

    Ken

  • I saved accidentally as my work ending on the date, so that not CS6 saved the file as fichier.02. PSD, how can I recover my work, because I closed CS6 and all lost.

    I saved accidentally as my work ending on the date, so that not CS6 saved the file as fichier.02. PSD, how can I recover my work, because I closed CS6 and all lost.

    Have you tried to change the extension. PSD

  • last working day of each week

    Hello world
    Could someone suggest how to configure Oracle 11g Scheduler so that it would start the last working day of each week? The last business day of the week is not always Friday; exceptional days are configured in separate planners, who are included or excluded in clause repeat_interval, (for example).

    The last business day of each month, works well, like this:

    BEGIN
    DBMS_SCHEDULER. () CREATE_SCHEDULE
    schedule_name = > "LAST_SETT_DAY_OF_MONTH"
    repeat_interval = > ' FREQ = MONTHLY; BYHOUR = 18; BYMINUTE = 30; BYDAY IS MON, MAR, SEA, GAME, FRI.; BYSETPOS =-1; EXCLUDE = HOLIDAY; INCLUDE = EXCEPTIONAL_WORKING_DAYS; ") ;
    END;

    But I want to run a similar logic for weeks.

    Thanks in advance

    OK, now I understand your request.
    I think it might be possible for PL/SQL function.
    Create the table suite where you put your nonworking days and the additional working days. To create the PL/SQL function and use

    CREATE TABLE day_list(
    DAY DATE NOT NULL,
    TYPE NUMBER(1) NOT NULL,
    CONSTRAINT pk_day_list PRIMARY KEY(DAY),
    CONSTRAINT ch_day_list_type CHECK(TYPE IN (1,2)));
    -- type 1-nonworking day,2-extra working day
    
    CREATE OR REPLACE FUNCTION last_working_day(p_date IN DATE) RETURN DATE AS
      v_retval DATE := TRUNC(p_date);
      v_aux    DATE;
    BEGIN
      IF v_retval IS NOT NULL
      THEN
        -- get next friday
        dbms_scheduler.evaluate_calendar_string(calendar_string => 'FREQ=DAILY; BYDAY=FRI',start_date => v_retval,return_date_after => v_retval,next_run_date => v_retval);
        -- check if SUNDAY or SATURDAY is extra working day
        SELECT MAX(DAY)
        INTO   v_aux
        FROM day_list
        WHERE TYPE=2
        AND DAY BETWEEN v_retval+1 AND v_retval+2;
        IF v_aux IS NOT NULL
        THEN
          v_retval := v_aux;
        ELSE
          -- find last working day from monday to friday
          WITH v_1 AS (SELECT v_retval - LEVEL +1 AS DAY
                         FROM dual
                         CONNECT BY LEVEL <=5)
          SELECT MAX(DAY)
          INTO   v_aux
          FROM (SELECT v_1.day, CASE WHEN t.type=1 THEN 0 ELSE 1 END is_working_day
                FROM v_1
                LEFT JOIN day_list t ON v_1.day=t.day AND t.type=1
                )
          WHERE is_working_day=1;
          -- there is a working day
          IF v_aux IS NOT NULL
          THEN
            v_retval := v_aux;
          ELSE
            -- go to next week
            v_retval := last_working_day(v_retval);
          END IF;
        END IF;
      END IF;
      RETURN v_retval;
    END;
    /  
    
  • Validate the difference in days between the dates in a table

    Greetings,

    I have a tabular form and date on each line. When the user saves the form, I want to sort the rows by chronological order of these dates, then go get the first and last date, calculate the difference between them and validate it.

    Does anyone know how to do?

    From now on, I came up with this:

    1. a PL/SQL Page process "before the calculations and Validations' which creates a collection and inserts lines in my tabular form (p_c004 being the date field):
    begin   
      if apex_collection.collection_exists('UPDATE_DATES') then
        apex_collection.delete_collection('UPDATE_DATES');
      end if;
    
      apex_collection.create_or_truncate_collection('UPDATE_DATES');
    
      for i in 1..apex_application.g_f04.count
      loop
          apex_collection.add_member(
              p_collection_name => 'UPDATE_DATES',
              p_c002            => htmldb_application.g_f02(i),
              p_c003            => htmldb_application.g_f03(i),
              p_c004            => htmldb_application.g_f04(i),
              p_c005            => htmldb_application.g_f05(i),
              p_c006            => htmldb_application.g_f06(i),
              p_c007            => htmldb_application.g_f07(i));
      end loop;
    end;
    and

    2. a "PL/SQL Error: Validation
    DECLARE
      l_count NUMBER;
    BEGIN
      apex_collection.sort_members('UPDATE_DATES', 4);
      l_count := apex_collection.collection_member_count('UPDATE_DATES');
    
      SELECT
      to_date(c004(l_count),'DD/MM/YYYY') - to_date(c004(1),'DD/MM/YYYY') Difference 
    
      FROM 
      apex_collections 
    
      WHERE 
      collection_name = 'UPDATE_DATES'
      and to_date(c004(l_count),'DD/MM/YYYY') - to_date(c004(1),'DD/MM/YYYY') < 30;
    
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        raise_application_error(-20101, 'Error');
    END;
    In my understanding, the validation must sort the collection in chronological order of the dates entered, calculate the difference in days between the nearest and farthest date and return it if it's less than 30 years (the difference in days allowed). If it's more than 30 years, the SELECT statement does not return anything and my block of exceptions raises a custom error that will trigger the validation "process of refusal."

    But when I try this, it tells me c004 does not exist and if I drop the parentheses, it works, but of course, it does not give the desired result.

    Any ideas?

    Best regards
    Mathieu

    Assuming that your domain is c004 then I don't see the need for the sorting of the collection.

    You can write a simple SQL select that sent you the desired result.

    Maybe something like this not tested

    SELECT
      max(to_date(c004,'DD/MM/YYYY')) - min(to_date(c004,'DD/MM/YYYY') ) Difference
      FROM apex_collections
      WHERE collection_name = 'UPDATE_DATES';
    

    The test if the result is > 30 days. If that's what you want to know.

  • find the days from the date of...

    Hi all

    I have a date saying (06-mar-2009), then how do you know what day is the same day as today (Friday)... and I need to create a table based on another table and must include all dates it's Saturday...

    If someone can help me...

    Thank you
    Pankaj

    If you are looking for the week then->

    CREATE TABLE test
    AS
      SELECT *
      FROM emp
      where to_char(hiredate,'DY') NOT IN ('SAT','SUN');
    

    Another thing,

    CREATE TABLE test
    AS
      SELECT *
      FROM emp
      where to_char(hiredate,'DY') IN ('SAT','SUN');
    

    Alternatively,.

    Please post your desired output of your sample data.

    Kind regards.

    LOULOU.

  • Field containing average function works only when the data are engaged on the same page. Does not work for fields on other pages.

    I'm having a problem with a field defined to calculate the average of eleven points fields (points 1 to 8 on page 1-9-11 on page 2). My original question was that it could exclude fields of points when they do not have information entered and adjust the average calculation (number of "divided by") accordingly.

    I had someone write JavaScript code for him, but I just found a small problem I don't know if it's something in the code or what the person who originally wrote the script cannot understand it either and suggested that I have post here.

    The middle area (located on the 2nd page of the pdf page two) seems to work exclusively with precision if at least one of the points of the fields on the 2nd page, 9, 10 (and 11) are engaged with the data. No values entered on the first page and only the first page, are for some reason any dividing by a more than expected. For example, if I fill the boxes 1, 2 and 3, it divides the total by four. If I filled just box 7, it halves. If I fill all 8 boxes on the 1st page, it divides by nine. It is corrected as soon as I get the points in one or more of the three boxes on the 2nd page points, suddenly the overall average is accurate. But if boxes 9, 10 and 11 contain no points, then the average is still inaccurate because the number of ' divide by "he uses is one more than what it should. I can't understand how to attach the form to this post, so I downloaded on Dropbox: Dropbox - used Evaluation.pdf.

    Under the direction of State: javascript came work to exclude the empty boxes when the points are entered in one of the three points of fields on the 2nd page (and more), but the average function is not accurate because it adds 1 to the number of ' divide by "in the calculation of the average If the points are only entered into the fields on the 1st page.

    Here's the code I entered in the 'Custom calculation Script' box in the 'Calculate' tab of the Properties menu of Test field:

    Initialize variables

    var num = 0;

    var sum = 0;

    Browse the input fields

    for (var i = 1; i < 12; i ++) {}

    var f = getField ("points." + i);

    If {(f.valueAsString)

    increment the counter to non-empty field

    NUM ++;

    Add the value of the running total field

    sum += + f.value;

    }

    }

    Calculate the average

    If {(num)

    Event.Value = sum / num;

    } else {}

    All fields are empty, then the empty value

    Event.Value = "";

    }

    I do not see that. Add the code of script debugging will display the results that each field is completed:

    Initialize variables
    var num = 0;
    var sum = 0;

    Browse the input fields
    for (var i = 1; i)< 12;="" i++)="">
    var f = getField ("points." + i);
    If {(f.valueAsString)
    increment the counter to non-empty field
    NUM ++;
    Add the value of the running total field
    sum += + f.value;
    }
    }
    Debug - display results as the form is filled;
    Console.Show
    Console.println (sum + "/" + num + "=" + sum/num);
    end of debugging;
    Calculate the average
    If {(num)
    Event.Value = sum / num;
    } else {}
    All fields are empty, then the empty value
    Event.Value = "";
    }

  • Can I remove the day of the date of blog?

    Hello, can someone help with this? I went through the documentation and google, I can't find an answer.

    How can I remove the day of the blog post so that the date reads simply "18 March 2015' and not 'Wednesday, 18 March 2015? '"

    I use this {tag_blogpostdate}, none of the other tags of here give me that http://docs.businesscatalyst.com/dev-assets/reference#! / tag-reference/Articles/blog-post-deta they - layout.html And I can't find anywhere that shows me how to customize IT.

    You can not, you have all the options except if you activate beta liquid markup and BC.next and then use the liquid and then apply the date filter. A little a lot right now, if you're not familiar, and it's the only thing you want to change at this point.

  • Display internal to 10 working days to the iRecruitment

    Gurus,

    I'm new to iRecruitment and would require assistance to get a feature.

    Client has a requirement in which they say that its employees in their organization can also apply to internal jobs for 10 working days before it is posted to the outside world.

    Can someone help me to achieve this?

    Kind regards

    Saurabh

    Have you checked the profile option - IRC: days of internal validation


    The implementation Guide - http://docs.oracle.com/cd/E18727_01/doc.121/e13518/T24319T440324.htm

    Set the days of display to set the number of days internal jobs

    If you want to make available the details of the work of your employees first, and then set the IRC: days of internal validation profile option. You specify the number of days during which the messages one app announced internally before posting the announcement on the external site.

    See you soon,.

    Vignesh

  • JavaScript works well with the date picker

    I tried onchange and onblur javascript events in the field of the HTML Form element...
    they work great with text fields... but not with the date picker...
    It seems after that date is selected, javascript is triggered, but set to get pulls the value of the field before the date chosen in the selector is placed here...

    is it possible to get the event fires with the value of dates...

    Hello

    Check your sample now.
    I have put your function setStatus page JavaScript and Execute when the Page loads

     $('#P1_DATE_FINISH').datepicker("option",{
      onClose:function(t,i){setStatus()}
     });
    
     $('#P1_DATE_START').datepicker("option",{
      onClose:function(t,i){setStatus()}
     });
    

    You can also replace this with

    $.datepicker.setDefaults({onClose:function(t,i){setStatus()}})
    

    Kind regards
    Jari

    Published by: jarola December 14, 2010 16:28

    You probably like to have event onchange in the text field, so I change to

    $('#P1_DATE_START,#P1_DATE_FINISH').datepicker("option",{
     onClose:function(t,i){setStatus()}
    }).change(function(){setStatus()});
    
  • SQL Developer: Right-click &gt; format works well with the DATE data type

    Hi all!

    Currently I use the version of SQL Developer Version 3.1.05.

    A question concerning the "auto-format" of syntax each time that writing in the code editor.

    If you take this code snippet and drop into a spreadsheet, then highlight it, right-click of the mouse and select "Format" it's like he fails to add the appropriate spacing when he runs in the DATE data type. I looked all through the: Preferences > database > sql formatter > formatting oracle > change and could not find anything about the formatting with date types.

    I'm looking in the wrong area? Is this a known bug? Am not too looking for this specific question. I LOVE the format function, but I hate having to go through each type of date and manually spacing everything make "clean". I'm picky I guess: P I can live with that but figured that I would ask.

    type TEMP_REC
    IS
    record
    (
    ORG_CODE VARCHAR2 (15).
    PROJECT VARCHAR2 (15).
    WBS VARCHAR2 (30),
    SERIAL_NO VARCHAR2 (30),
    NUMBER OF QTY_ORDERED
    NUMBER OF QTY_SCRAPPED
    NUMBER OF QTY_COMPLETE
    NUMBER OF BOM_ID
    DATE OF REQUEST_DATE,
    CREATE_DATE DATE,
    DATE OF REL_DATE,
    START_DATE DATE,
    DATE OF NEED_DATE,
    END_DATE DATE,
    DATE OF COMPLETE_DATE,
    CREATED_BY VARCHAR2 (30),
    MODIFIED_BY VARCHAR2 (30),
    MODIFY_DATE DATE,
    EST_HOURS NUMBER (6.2),
    ACT_HOURS NUMBER (6.2),
    BAD_COMMENTS VARCHAR2 (1000));

    I can see it now with your last test case. It also changes the future alignment of the varchar2 and number of columns. that is before the date column the varchars line to column 19, after it the line upward in column 18.

    It looks like a bug.

  • Same scenario... in form, but in another work get error "the Date is not a constructor.

    Using this javascript in one of my forms in timestamp it, (just a simple secure text field.)

    Form1. MainPage.DateTimeStamp::docReady - (JavaScript, client)

    If (form1. MainPage.DateTimeStamp.rawValue == null) {}
    var now = new Date();
    Form1. MainPage.DateTimeStamp.rawValue = nowtoDateString() + now.toTimeString ();
    }

    This time stamp the shape she should.  The problem is on another form that I build, I use the same script (with a different absolute paths, of course) and I get an error on the date javascript is not not a builder.  I type the script in ten bajillion times and I am at a loss for what is the cause.

    All I want is a javascrip simpel where I can display the time/date of the system to users in a text field.

    Hello

    Is it maybe something else in the present form called Date... a subform, field, object, script, or something that JavaScript would take first before the Date object inbuild?

  • given number of working days for the current month to date

    Hello

    How can I get the number of days of data using SQL date? appreciate for your help. Thank you.

    Hello

    Whenever you have a problem, please report all that is necessary for people to recreate the problem and test their ideas.  In this case, including CREATE TABLE and instructions INSERT for all necessary tables (just a few lines, only relevant columns) and the results you want from this data.

    The syntax of a scalar subquery (that is, a query that takes the place of a single value, as in a CASE expression) is

    (

    SELECT...

    Of...

    )

    in other words, all of the query must be within parentheses surrounding nothing else.  It seems that you have the SELECT keyword in a CASE expression without a parenthesis opening right before she left.

Maybe you are looking for

  • How to set my home page in Firefox?

    Please help me

  • remove the column in csv

    No one knows how to delete a column, or changing the values in this column and leave the rest in a csv file? Example: CSV file has 70 rows and 40 columns. To remove a column or change its values. Thanks in advance.

  • Question about Acer eRecovery USB key

    Hi friends Acer, I need your helping hands. I wanted to make sure IF I order Acer eRecovery USB key for my UltraBook S7-391 and he's going to recover my system back to factory with the original score of 3 (2 were hidden)? Even if I deleted my hard dr

  • Error message when you try to change startup programs

    Received error 0x800705b4 trying to 'change the startup programs '. When you try to change my startup programs, I got a message that Windows Defender is disabled. When I click on the button to turn on the Defender, I get the message "Microsoft Defend

  • BlackBerry Z30 disable Blackberry Assistant wishes text when connecting via bluetooth

    My updated Z30 to update to the latest OS 10.3.1.1581. Now every time that in connects to Ford Sync via Bluetooth, I get a text message telling me what day it is. It very quickly becomes boring. Can someone direct me to how to disable the welcome mes