How do the 3rd week (business day) of the month in a date range?
Hello
I'm trying to find the 3rd day of the work week of each month in a given range of dates. How is it possible in a SQL query? Thank you in advance.
Hello
Here's one way:
SELECT first_day + BOX
WHEN TO_CHAR (first_day, "DY") IN ("play", "Fri", "SAT")
THEN 4
WHEN TO_CHAR (first_day, "DY") ("SUN")
THEN 3
2 ELSE
END AS workday_3
DE)
SELECT ADD_MONTHS (first_month
, LEVEL - 1
) AS first_day
DE)
SELECT TO_DATE ('Sep 2013', 'My YYYY') AS first_month
, TO_DATE ('Jan 2014', 'Mon YYYY') AS last_month
OF the double
)
CONNECT BY LEVEL<= 1="" +="" months_between="" (last_month,="">=>
)
ORDER BY workday_3
;
In another thread,.
https://community.Oracle.com/thread/3513808
you said that you had problems using a WITH clause, so I used online views instead of CLAUSES.
With the above parameters, the result is:
WORKDAY_3
---------------
Wed 04-Sep-2013
Set of 3 October 2013
November 5, 2013 Mar
Wednesday, December 4, 2013
Fri January 3, 2014
Tags: Database
Similar Questions
-
Display the months between two dates
Hello:
I need all the months between two dates. I entered two dates as January 15, 2001 and 2011-mar-03. I want the result as below.
JANUARY 15, 2011 - JANUARY 31, 2011
February 1, 2011 - February 28, 2011
MARCH 1, 2011 - MARCH 3, 2011
I held this result of sql query in oracle. Could you please suggest me?
Thanks in advance.
AbhishekSELECT GREATEST(st, ADD_MONTHS(TRUNC(st, 'MONTH'), (LEVEL - 1))) dt, LEAST(ed, LAST_DAY(ADD_MONTHS(TRUNC(st, 'MONTH'), (LEVEL - 1)))) ld FROM (SELECT DATE '2011-01-15' AS st, DATE '2011-03-03' AS ed FROM DUAL) CONNECT BY LEVEL <= MONTHS_BETWEEN(TRUNC(ed, 'MONTH'), TRUNC(st, 'MONTH')) + 1 ORDER BY 1; DT LD ------------------------ ------------------------ 15.01.2011 00:00:00 31.01.2011 00:00:00 01.02.2011 00:00:00 28.02.2011 00:00:00 01.03.2011 00:00:00 03.03.2011 00:00:00
HTH, Urs
-
How to increase the available on report date range
Hi gurus,
On the BigBrother report page, we can define the date range considered. The date start and end on our BigBrother cannot be defined until 2010 (see this screen below). How can I report for 2012 and beyond?
Any help will be very appreciated!
Michael
Micheal,
Here's how I did it.
I have the latest version for free.
Modify the [BBHOME]/www/help/bb-rep.html file
Line 95:
And also to line 153:
I hope this helps!
-
Calc for the month that has data
Hi - I have a calc below script, works, except that it fills for all months, but I want only the amount of change/fill when there is data in the months to "W1 - PR". I tried to say in my statement, if the amount is higher, then 0, then do the math, but miss me something, since it is still filling for all months.
Accounts - Dense
Periods of time - Dense
Feature - sparse
Types - sparse
Years - sparse
Scenario - sparse
Versions - sparse
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DIFFICULTY (FY09, estimate3, sandbox, A)
"w1 - pr".
(
IF (@ISMBR (Estimate3) and @ISMBR("w1-pr") and @ISMBR ("sum Adeath") > 0)
"Amount Depr'->"w1 - PR"= Jan->"license fees"-> NA_PT * Dec->"Amount Adeath"->"Split %. " 01;
ENDIF
)
ENDFIXand @ISMBR ("sum Adeath") > 0
Is not what you think it is. ISMBR returns true or false, not the value of data.
try to use only
and 'Adeath amount' > 0
-
How does the work in AS3 data formatting?
In some of my older languages, I could convert various types of data in a well-formatted string.
For example «!» x (20)"would be uppercase the first letter of the string.
"$> > >, > > 9.99 would give me $1.23.
(999) 999-9999 converting an integer or a string in a beautiful phone number research
etc, etc.
How did this kind of thing better done in AS 3?
Also, is there a way to feed these masks to the text input controls so that (for example) a telephone number can be entered one already visible (de)-
Thaks,
VC
The default controls are not hidden input, but some third-party controls
do.
There is a formatting help in StringFormatter and StringUtil
-
How is the new warnings to date have the same version as the oldest?
I got an email about new updates to my PC. In any case I noticed that I think that all or certain updates have the same version as the previous drivers.
So why is it?
Hello
Is the update also the same thing? In any case, if your device works Scott it is not useless to put anything.
It will also be interesting to know what model of laptop you have and updates are available.
-
How does the DAQ hardware with data acquisition?
I'm sampling of 8 channels at 2.5 MHz I I need to know if the DAQmx 6133 I use gets every channel at 2.5 MHz or if she gets every channel (2.5/8) MHz. For example if I had a channel it can get up to 2.5 MHz, but if I get 8 channels, this channel will get samples in high 312, 5 kHz (= 2.5 / 8 MHz).
Can someone help me out here?
Thank you
Rafael
Hello Rafael,.
The NI 6133 is a module for simultaneous sampling. This means that there is an NOC for each channel on the device. If you look at the Specifications for the 6133 OR you can see that the maximum sampling frequency is specified as 2.5 MS/second. There is one by the channel for this device specification. Thus, you can enjoy all 8 channels at 2.5 MS per second instead of having to use the overall rate of 2.5/8 MS/second when acquiring on all channels.
-
The month number convert date to string
Hello
I have a text box, where any Date I chose, the Datefield is inserted. It inserts a date in the format 05/03/07, but I want to March 5, 2007. How can I do this?
The code I have is:
Thank you
Paul
It should work
Aspar
-
How to calculate the first day of the month following in BI Publisher
I need to be able to calculate the first day of the month of a date field in a BI Publisher model. The field name is COL_CLM_180 and contains a date in the format "YYYY-MM-DD". I have found so far any documentation that still gives me an idea of what to do.
Any help or advice would be appreciated
Hi - thank you very much for your help. Your last answer got me going in the right direction and I indeed was dense. I don't know why I don't think to the calculation in the original query. I put the statement: TRUNC (ADD_MONTHS(A.COL_CLM_180,1), 'MM') in a column in the query of conduct and it has worked flawlessly. Thank you - thank you - thank you.
-
Hello
How can I get the (day number of the) last day of a given month and year?
So, if
year 2015 = and month = 1, the output should be 31
year = 2012 and month = 2 while production is expected to be 29
year 2013 = and month = 2 while production is expected to be 28
etc.
Y at - it no OBIEE to achieve? If not, then a command SQL Oracle is very good too (I prefer OBIEE however)
Thanks in advance,
Erik
You start from the first day of the month, you add 1 month [TIMESTAMPADD (SQL_TSI_MONTH, 1, 'your date')], you must subtract 1 day [TIMESTAMPADD (SQL_TSI_DAY,-1, 'your date')] and use the DAYOFMONTH function to get the number of the last day of the month [DAYOFMONTH ('your ' date')].
All these calls nesting together and you're there.
-
Windows Backup & restore leaves gaps in the backup period date ranges
I noticed that backup & restore leaves gaps in the date ranges displayed on the screen of backup periods under the function to manage the space. This means that files change during the interval periods have not been saved? For example, the screen shows currently backups and the following periods:
Jan 26: 12-18 Mar, 12 GB 10.40
Apr 04, 12-13 Apr, 12 GB 19.62
27 April, 12-27 Apr, 12 GB 05.16
May 06,12 - May 06,12 02.41 GB
May 27.12 - 17 Jun, 12 GB 03.41
What is the importance of gaps?
How can I tell that B & R is fully backup all files that changed since the last backup run?
How can I varify the 1st backup is a backup full?
How can I varify that the system image backup is up-to-date?
I save approximately once a week to a USB external hard drive. I use options "Include a system image" and "Let me choose" to select the files and have selected the option 'keep only the last frame system & minimize the space used '.
Hello
Backups are created in sets called backup periods. To maximize your disk space, Windows backup backup all folders selected, the first time it's run and then it only backs up files that are new or have been modified since the last backup was made. Periodically, Windows creates a new, full backup. Each full backup is called in a backup. When you view your backups of files, you can see all the backup periods with date ranges. If you decide to delete backups of files, you should always keep the most recent backup of the file.
Reference:
Should what backup settings I use to maximize my disk space? http://Windows.Microsoft.com/en-us/Windows7/what-backup-settings-should-I-use-to-maximize-my-disk-space
Back up and restore: frequently asked questions
http://Windows.Microsoft.com/en-us/Windows7/products/features/backup-and-restore
-
calculate a date field first of the month
I need to calculate a date field using date of hire as a base date, and it should return the first of the month following 30 days of date of hire. (date of rental + 30 days then first of the month following that date).
Hello margery497,
In this scenario, you can create a text field 1 with validation as a calculated field and can add now() formula inside. Then, in the text field 2, you can add the now() + 30 formula and save it with the calculated field.
Here is the reference for validating field:
http://helpx.Adobe.com/EchoSign/KB/form-fields---validations.html
Kind regards
-Usman
-
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!
JamieHi Jamie,
Through this links...
http://www.bravesoft.com/blog/?p=682
http://twobiee.blogspot.in/2012/01/working-with-date-differences.htmlMark as correct it allows u...
Thank you... -
How to get the last business day of the previous month?
Hi all
We need the user as below,
If the user select 18 June 2015 ' quick dashboard as the input value, and then they want to see last month last day of work (business date: 29-may-2015) amount in report, if you have an idea please share with us.thanks
Note:
use under request we can able to get the last day of the previous month, we want to for the last business day of the last month, based on the date of entry of the user?
TIMESTAMPADD (SQL_TSI_DAY,-(1), TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH ("DIM_TIME". ("" DataDate ") *-(1) + 1,"DIM_TIME ". (("" DataDate "))
Thank you
Deva
Try this,
case when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 1 then timestampadd (sql_tsi_day, (Dayofmonth(Date '2015-06-15') *-1)-2, Date '' 2015-06-15) when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 7 then timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1-1, Date '' 2015-06-15) another timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15') end
As Ftsiot said in this post, it will work only to exclude the sat and Sun. Another one if you want to exclude regional holiday, you may need a calendar in DB table.
Thank you
AJ
-
How to view the 3rd working day of each month.
Hello
could someone help me with a proc to display the 3 day working rd of each month?
By day, I mean working Mon - Fri.
Thank you.Hello
Sorry, I initially responded to the question "what is the * first * work of the month ', which is a little easier.
Here's a way you can code in SQL:
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-Mon-YYYY Dy'; WITH got_dates AS ( SELECT TRUNC ( ADD_MONTHS (SYSDATE, LEVEL) , 'MONTH' ) AS a_date FROM dual CONNECT BY LEVEL <= 12 ) -- The part above just generates some sample dates -- The part below is the actual query: -- SELECT a_date , CASE TO_CHAR ( a_date + 2 , 'fmDay' , 'NLS_DATE_LANGUAGE=ENGLISH' -- If needed ) WHEN 'Monday' THEN 4 WHEN 'Tuesday' THEN 3 WHEN 'Saturday' THEN 4 WHEN 'Sunday' THEN 4 ELSE 2 END + a_date AS third_workday FROM got_dates ORDER BY a_date ;
Output:
A_DATE THIRD_WORKDAY --------------- --------------- 01-Nov-2012 Thu 05-Nov-2012 Mon 01-Dec-2012 Sat 05-Dec-2012 Wed 01-Jan-2013 Tue 03-Jan-2013 Thu 01-Feb-2013 Fri 05-Feb-2013 Tue 01-Mar-2013 Fri 05-Mar-2013 Tue 01-Apr-2013 Mon 03-Apr-2013 Wed 01-May-2013 Wed 03-May-2013 Fri 01-Jun-2013 Sat 05-Jun-2013 Wed 01-Jul-2013 Mon 03-Jul-2013 Wed 01-Aug-2013 Thu 05-Aug-2013 Mon 01-Sep-2013 Sun 04-Sep-2013 Wed 01-Oct-2013 Tue 03-Oct-2013 Thu
Published by: Frank Kulash, October 4, 2012 17:56
Maybe you are looking for
-
Hi, my iphone 5 loser signal everytime I lock TI-display switch turned off. After the minute signal will seeded bar to bar no service... There's like it until I unlock TI-turn on the screen. Now, I upgraded ios9 to ios 10, no change. I also re-pop an
-
These are the details. 21 FF does not work on my system, unless I choose Run as administrator. So far, none of the assumptions posted by your technical support on this issue in the past have worked. I removed the virus and removed FF and reinstalled.
-
My computer is a 64-bit Windows 7 Home Premium. Lately, I'm getting several BSOD per day. I searched the forums on the Internet and have not found response. This is the diagnosis that came: Signature of the problem: Problem event name: BlueScreen
-
empty fields of digital painting
Hello I am creating a table digital indicator that contains blank fields for all the odd index. For example, (i = 1, 3, 5, etc...) Currently, I have a case structure to determine if the index is odd or even. For a same index, I pass the appropriate v
-
If I press START, then HELP AND SUPPORT, the page is in place. On the page the photo iconsare not displayed. Here is an example of what I'm saying. The problem is in the line wherex is present instead of the photo icon and it says the following: Use