Subtract the number of days which falls a Saturday and Sunday
HelloI want to calculate the productivity of employees using the fields of activity by obtaining the number of days and the number of hours. However, the number of days must not include sat and Sun. Refer to the table below:
TABLE:
Year - Date name - number of hours of
2010 - Joe - 2010-07-05 - 8
2010 - Joe - 06/07/2010 - 4
2010 - Joe - 06/07/2010 - 4
2010 - Joe - 2010-07-07 - 8
2010 - Joe - 2010-07-08 - 8
2010 - Joe - 09/07/2010 - 4
2010 - Joe - 09/07/2010 - 4
2010 - Joe - 2010-07-10 - 8
2010 - Joe - 11/07/2010 - 8
I converted the date field to #of days of Count (Distinct (Date)) using
Year - Name-# of days - number of hours of
2010 - Joe - 7-56
Now, I want to subtract the number of days which falls a Saturday and Sunday without affecting the hours #of. Is this possible?
Year - Name-# of days-# of Hours_
2010 - Joe - 5-56
Try to use Count (Distinct (Date))-Count (Distinct BOX WHEN DAYOFWEEK (fx) IN (6,7) THEN NULL ELSE END fx)
where Fx is the expression of your date field
Tags: Oracle
Similar Questions
-
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.
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
-
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 :)
-
Count of the number of days in a calendar month according to the year
Hi all
On my table, column 1 is the list of months over several years.
Column 2 is the activity number od each month.
Column 3 I want an average rate of activity per day during the month, which should be: (C2 / number of days according to C1) %
Problem: I can't find a fomula give me the number of days, particularly in February when the year is leap.
Any help is appreciated.
Thank you all,
Lopez
PS: by the way, with this new version of Apple Comunity I seem to have lost my previous questions about the numbers.
Hey Lopez,
EOMONTH(A1,0) (end of month) will GET help you.
Column B is Date & time format to display only the month and year (actually the 1st of the month, but the day is not displayed).
Formula in C2 (fill down)
= EOMONTH(B2,0)
The end of the month 0 months later.
Formula in D2 (fill down)
= DAY (C2)
February 2015 (non-leap years) shows 28
February 2016 (leap year) shows 29
Kind regards
Ian.
-
In tools, under the protection of personal information, I was able to set the number of days during which the browser history... Very handy when you need to keep a record of sites visited. Now in Firefox4 I have "Remember history" option. How will I know how the newspaper story is saved for the moment?
In Firefox 4 you can no longer set the number of days of historic preservation. The method used by Firefox to store history has changed, for more details on the changes, see http://blog.bonardo.net/2010/01/20/places-got-async-expiration
-
Calculate the number of days remaining until the next anniversary. Help, please!
Hi guys,.
I'm new to the forum and to the development of BB. So please do not judge harshly if the answer to my question seems obvious.
I need to calculate the number of days until the next birthday (taking into account any valid birth date)
After looking at the API and the forum search, I realized that I could
calculate the difference between two dates in milliseconds and then divide the delta of the value of a day in milliseconds. That is to say:
birthdayCalendar.set (Calendar.YEAR, those);
Date1 = birthdayCalendar.getTime () .getTime ();
date2 = System.currentTimeMillis ();
Delta = date1 - date2
numOfDays = delta\DateTimeUtilities.ONEDAY
Here's my question. How do I create a valid date1 what about leap years?
Maybe there's a better way to solve this problem?
Any help is greatly appreciated.
I agree that the determination of the number of days between today and Feb. 29 could be a little difficult, if it is not a leap year. I suspect that the calendar has a certain built-in mechanism to compensate for this, but your solution to choose a date is better.
DST has a role to play, and Yes, the calendar makes up for it. Let us take two dates, for example (before DST) March 1 and June 1 (after the DST). If you take a calendar and set the same hour, minute, etc., they are all the same except for dates, then subtract one from the other, and then divide by the number of milliseconds in 1 hour, you calculate the number of hours between the same time on two different days. You will find that it is not a multiple of 24 hours - because there is actually an hour less than the number of days since the clocks move forward (in the northern hemisphere anyway...),
In your case, you are not calculating the number of hours, you calculate the number of days. But you will be dividing by [24 * (time in an hour)]. If you take [23 * (time in an hour)] and divide it by [24 * (time in an hour)], using arithmetic on integers, you will end up 0. The easiest to get around this, who also works for the end of the DST too, is to simply add one hour to the date before the division.
Hope that makes sense...
-
Dynamic calculation of the number of days between two dates in a table
Hello
I'm working on request where I dynamically calculate the number of days between two dates in a table.
The calculation must be dynamic, i.e., when I recover the Start_date and End_date and move to the field following (call_duration) in the same row, the difference must be calculated dynamically in this area and make sure the field read-only.
APEX version: 5.0
Hi BO123,
BO123 wrote:
Hello
I'm working on request where I dynamically calculate the number of days between two dates in a table.
The calculation must be dynamic, i.e., when I recover the Start_date and End_date and move to the field following (call_duration) in the same row, the difference must be calculated dynamically in this area and make sure the field read-only.
APEX version: 5.0
one of the way to do this by calling ajax on change of end_date.
See the sample code given below to fetch the resulting duration and making the field read only after calculation
Step 1: Change your page
under CSS-> Inline, put the code below
.row_item_disabled { cursor: default; opacity: 0.5; filter: alpha(opacity=50); pointer-events: none; }
Step 2: Create on demand Ajax process I say CALC_DURATION
Please check Procces Ajax, see line 6.7 How to assign a value to the variable sent by ajax call
Declare p_start_date date; p_end_date date; p_duration number; Begin p_start_date := to_date(apex_application.g_x01); p_end_date := to_date(apex_application.g_x02); --do your calculation and assign the output to the variable p_duration select p_end_date - p_start_date into p_duration from dual; -- return calculated duration sys.htp.p(p_duration); End;
Step 3: Create the javascript function
Change your page-> the function and the declaration of the Global Variable-> put the javascript function
You must extract the rowid in the first place, for which you want to set the time, see line 2
assuming f06, f07 and f08 is the id of the start date, and end date columns respectively, and duration
See no line no 8 how set the value returned by the process of ajax at the duration column
Replace your column to the respective column identifiers in the code below
function f_calulate_duration(pThis) { var row_id = pThis.id.substr(4); var start_date = $('#f06_'+row_id).val(); apex.server.process ( "CALC_DURATION", { x01: start_date,x02: $(pThis).val() }, { success: function( pData ) { // set duration to duration column $('#f08_'+row_id).val(pData); // disable duration column $("#f08_" + row_id).attr("readonly", true).addClass('row_item_disabled'); } }); }
Step 4: choose the end date call the javascript function
Go to report attributes-> edit your Date column end-> column-> Attrbiutes element attributes-> put the code below
onchange="javascript:f_calulate_duration(this);"
hope this helps you,
Kind regards
Jitendra
-
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); //29I 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;
}
-
Count the number of days of previous instance entity
Hello
My context, global and one of many relationship which is a list of contracts.
I think I can explain my problem with an example:
Contract 1:
Start date: 01/01/2013
End date: 31/03/2013
2 contract:
Start date: 05/01/2013
End date: 31/08/2013
Contract 3:
Start date: 11/01/2013
End date: 31/03/2014
I want to do this:
For contract 3, calculate the number of days for contract 1 + contract 2 + 3 contract
For the market 2, calculate the number of days for the 2 + 3 on contract market
To contract 1, calculete number of days for contract 1
Moreover, I would calculate the number of days limited to 28 months before the date of the end of each contract.
For contract 3 calculate the number of days until the 31/03/2014 but on 30/11/2011.
Means that
-If a contract of 4 ends before 30/11/2011-> not taken
-If a contract of 4 begins on 11/01/2011 and ends on 15/12/2011, the days of the 12/01/2011 to 15/12/2012 are taken into account.
For contract 2 calculate the number of days until the 31/08/2013, but since 30/04/2011.
Means that
-If a contract of 4 ends before 30/11/2011-> not taken
-If a contract of 4 begins on 11/01/2011 and ends 15/12/2011-> not taken
Hope my explanation is clear.
I don't know how mixt:
temporal reasoning
reasoning of entities
through the reasoning of entities
as
-for a contract, I have to see all deals before and not one after (cross entities reasoning)
-I have to count a number of days, but if there is a period without a contract that I have to ignore days (temporal reasoning)
Then I am quite lost.
If anyone can help me in this situation aprehendate the appropriate.
Thank you.
Hey guys I think I found the solution, here my idea in french (sorry my client is franco-french):
the contract if course of est en
Temporelencoursouapres (contract start date)
and
TemporelEnCoursOuAvant (date of end of contract)
a contract is being so
Exists (employment of the applicant, the contract is ongoing)
the value of the number of days to count pour the contract to determine the last date of end of contract to take into account
0
TemporelAvant (InstancesMinimum (employment of the applicant, the start date of the contract))
0
TemporelAvant (the start date of the contract to determine the last date of end of contract to take into account)
0
Temporelapres (InstancesMaximum (employment of the applicant, the end date of the contract))
0
Temporelapres (date of end of contract)
0
Temporelapres (the end date of the contract to determine the last date of end of contract to take into account)
3
the day is the last day of February
and
Temporelencoursouapres (the start date of the contract to determine the last date of end of contract to take into account)
and
a contract is underway
1
No (the day is the last day of February)
and
Temporelencoursouapres (the start date of the contract to determine the last date of end of contract to take into account)
and
a contract is underway
0
otherwise
the value of the number of days through contracts pour prescribe the last contract end date to take into account = Temporeldatedepuisdebut (all jobs of the applicant, the date (the number of months to be taken into account for the period affiliation) months before the end date of the contract, the value of the number of days from paying the contract to determine the last date of end of contract to take into account)
the duration of contracts from pour prescribe the last contract end date to take into account = IntervalleSommeQuotidienne (the start date of the contract to determine the last date of end of contract to be taken into account; AddDays (InstancesMaximum (employment of the applicant, the end date of the contract) 1); the value of the number of days through contracts pour prescribe the latest end date of contract to take into account)
-
SQL to count the number of days of January with a range of dates
I have data like this, how to calculate the number of days with January in this date range.
BEGINNING END DAYS OF JAN 12/12/2013 20/01/2014 20 21/01/2014 02/02/2014 11 Hello
So, you want to count the number of days between
(a) either start_dt, or January 1, 2014 (prevailing later) and
(b) or end_dt or January 31, 2014 (whichever comes first).
However, if start_dt and end_dt are prior to January 2014 (or both are later) which will result in a number negative if you take the difference or 0, if it is higher.
This looks like a job for the GREATER and LESS than functions.
SELECT start_dt - START is not a column name good
, end_dt - is neither END
BIGGER (1 + LESS (end_dt, DATE ' 2014-01-31'))
-Most GREAT (start_dt, DATE '' 2014-01-01)
* v
) AS jan_days
FROM table_x
;
If you would care to post CREATE TABLE and INSERT instructions for some examples of data, then I could test it.
-
JavaScript anomaly on the number of days between two dates
Use ApEx 4.0, I found an anomaly in a javascript code that calculates the number of days between two dates, the current_date and the past_date. If the past and present is the or before March 10, 2013, and the current_date lies between 10 March 2013 and November 3, 2013, the number of days will be from 1 day to less than the actual number. Between November 3, 2013 and on 4 November 2013, the increments of number by 2, then the count will be accurate from this date forward.
Here are some examples:
March 10, 2013 = 69 days of December 31, 2012
March 11, 2013 = 69 days of December 31, 2012
March 12, 2013 = 70 days of December 31, 2012
November 3, 2013 = 306 days in December 31, 2012
November 4, 2013 = 308 days in December 31, 2012
11 March should be 70 and 12 March should be 71. November 3 is 307 and 4 November corrects the number of fake, which began March 11.
Change the past_date to March 10, 2013 produces the following:
March 10, 2013 = 0 days of March 10, 2013
March 11, 2013 = 0 days of March 10, 2013
March 12, 2013 = 1 days of March 10, 2013
But change the past_date to 11 March 2013, product of the correct numbers:
March 11, 2013 = 0 days of March 11, 2013
March 12, 2013 = 1 days of March 11, 2013
March 13, 2013 = 2 days of March 11, 2013
I would certainly all help to determine the cause of this anomaly. Here's the javascript code:
var w1 = ($v ("P48_PAST_DATE"));
W1 = (w1.toString ());
vmon var = (w1.substr (3.3));
vyr var = (w1.substr (7));
var r = (vyr.length);
If (r == 2)
vyr. = (parseFloat (vyr) + 2000);
vday var = (w1.substr (0.2));
var y = (vmon.concat ("", vday, ",", vyr));
y = Date.parse (y);
var w2 = ($v ("P48_CURRENT_DATE"));
var vmon2 = (w2.substr (3.3));
var vyr2 = (w2.substr (7));
var vday2 = (w2.substr (0.2));
var x = (vmon2.concat ("", vday2, ",", vyr2));
x = Date.parse (x);
var numdays = (x - y);
numdays = (Math.floor(numdays / 86400000));
$s ("P48_NUMBEROFDAYS", numdays);Did you google for something like "javascript number of days between two dates. I think you will find the explanation to this observation:
This method does not work correctly if there is an advanced economies jump between the two dates.
There are examples available to calculate the difference between two dates.
-
How to get the number of days in a month of belonging to a range of dates
Hi, I'm going crazy around a problem, I have 2 dates and one month I wanto to retrieve the number of days belonging to the months that fall within the range.
for example:
month of January 2011. begin_date = January 11, 2011, May 30, 2011 end_date result is 21
month of January 2011. begin_date = December 11, 2010, result of end_date, January 10, 2011 10
month January 2011 .begin_date = 2 February 2011, end_date may 25, 2011 result 0
month of January 2011. begin_date = January 3, 2011, January 5, 2011 result DATE END 3
and so on...
I appreciate any suggestion
Thank you
AndreaSomething like that... ?
SQL> with t as 2 (select to_date('11/01/11','dd/mm/yy') from_dt, 3 to_date('30/05/11','dd/mm/yy') to_dt, 4 'Jan-11' mnth from dual) 5 select least(last_day(to_date(mnth,'Mon-yy')),to_dt) - 6 greatest(to_date(mnth,'Mon-yy'),from_dt) cnt 7 from t ; CNT ---------- 20
If 0 is also expected...
SQL> with t as 2 (select to_date('11/01/11','dd/mm/yy') from_dt, 3 to_date('30/05/11','dd/mm/yy') to_dt, 4 'Jan-11' mnth from dual union all 5 select to_date('11/01/11','dd/mm/yy') from_dt, 6 to_date('30/05/11','dd/mm/yy') to_dt, 7 'Jan-12' mnth from dual 8 ) 9 select from_dt,to_dt,mnth, 10 greatest( 11 least(last_day(to_date(mnth,'Mon-yy')),to_dt) 12 - 13 greatest(to_date(mnth,'Mon-yy'),from_dt) 14 ,0) cnt 15 from t; FROM_DT TO_DT MNTH CNT --------- --------- ------ ---------- 11-JAN-11 30-MAY-11 Jan-11 20 11-JAN-11 30-MAY-11 Jan-12 0
Published by: JAC on February 9, 2012 19:22
-
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)
-
Function to return the number of days in a month?
In one of my rules, I need to allocate an amount of benefits based on the number of days remaining in the calendar month.
OPM does have a function that can provide me with the number of days in a calendar month?
Thank you very much
IsamuIt is not a direct function to do this, however, it can be done with a bit of messing around. The following rules you will get the number of days of the month of the date of the date
Basically, you get the first day of the month, add a month to the first day of the following month and then get the number of days between them, which will give you the number of days of the month of the date
the month = ExtractMonth(the date) the year = ExtractYear(the date) the start of the month =MakeDate(the year, the month, 1) the start of the next month = AddMonths(the start of the month, 1) The number of days in the month = DayDifference(the start of the month, the start of the next month)
These rules can be a little more compact, but it is basically how to do it.
-
is there a way to display the value of the "number of days to the stadium' in communication?
given that 'number of days at the stage' appears in the historic area and analytics, can we get the value to display in the review section?
We have an oppo report which comes from the reports section because we need current data, but we also need to display the "number of days at the stage", which is only seen in the analytical section.Hello Janet,.
It is rather lengthy to explain. I recommend you to get the book "CRM on demand report - Michael D.Lairson" it's a great book covering analytics in every detail.
In the meantime, here's an excerpt from the book:
Page (400)
The combination of reports in a single report
There are many common situations where you may find that you need a combined analysis.
Some of them do not have access to all the columns of data in a single domain, with data
missing lines due to a natural inner join which causes the report to abandon the lines where it not associated
value exists in another table, or having several columns of the same type that you want to
display in a single column.To create a combined analysis, first create a new report, based on the most appropriate subject
area, add all the columns you want displayed in your report. It's a good idea to move forward
and define the order of the columns now, because it's a bit more complicated to do so after the combination
the report with another report.In step 1 of the window of generation and analysis, expand the section advanced down
of the window. Click the combine with similar analysis button to open a list of all subjects
(see Figure 15-3). You can select a different domain or the same field, you are already
in collaboration with. Click the topic of your choice.The window that appears, shown in Figure 15-4, includes a few new items. Set operations
section now contains three links: the link to columns of results and criteria for your original links
report columns and the columns of your newly added report. The columns of the article shows the
columns of the report based on the link selected in the operations section.The results columns are columns that will appear in the final report of the combination
the criteria columns. You will notice that when you have selected the columns of results across
Operations, each specified column section in the columns section has the properties of the columns, change
Form and Order By buttons that you're used to seeing in your columns of the report. The
formulas in columns of results are empty, however.Click on the first link of criteria, and you will see the columns that you added to your report.
Notice that each column contains now that the button change the formula. The columns that will beRead Page (401) in the rooms - courtesy of Google Book Search. All of this is taken from the book, but should give you enough information to get what you are looking for.
http://books.google.co.uk/books?id=OnbYrkWa4RsC&pg=PA404&lpg=PA404&dq=CRM+On+Demand+-UnionReport&source=bl&ots=qxxnaCWoqV&sig=3P23kMIl-4IIz324jQwZZ6oHb6U&hl=en&ei=qlBtTJ-3GNO4jAe7-fj7CA&sa=X&oi=book_result&ct=result&resnum=1&ved=0CB4Q6AEwAA#v=onepage&q=CRM%20On%20Demand%20-%20Union%20Report&f=false
Maybe you are looking for
-
Pavilion 23-q030na: 32-bit or 64-bit
Hello My computer says it has a 64-bit operating system, I wondered what that meant? I have already installed Microsoft Office on this subject, but I installed the 32 bit version... is this correct? Thanks in advance for your help, jdshaw
-
HP Pavilion Notebook-15-p212n: decommissioning of my HP Pavilion Notebook-15-p212ns for Win 7
Hello I recently downgrade my HP Pavilion Notebook-15-p212ns from 8.1 to win for Win 7 32 bit, but miss me the drivers and the HP support center provides them. Here are the details of HP: Product name - 15-p212ns Product number - L5Z25EA #ABE Micropr
-
Advanced is not enabled for sound and voice records
original title: Panel > sounds and audio devices > audio > audio recording > advanced is not enabled Control Panel > sounds and audio devices > audio > audio recording > advanced is not enabled Control Panel > sounds and audio devices > voice > voice
-
Cloning of servers and Agent Manager
I'm running into a situation where our AIX engineers are cloning of servers with configurations Manager Agent. When I check the configuration file for the Agent on the cloned Server Manager it shows the host name of cloned servers and agents. What is
-
Unable to see AP on the first 2.2 infrastructure
Hello Recently, I have added a new series of AP 2600 in my network. I WLC 8.3.102.0 and first 2.2.0.0.158, but I find this access point to this topic. This Approach works well with users. Any idea! See you soon