How to calculate the no. of weekdays between two active dates
Hi all,
I need to calculate the no. of weekdays between two days.
For Example:
If i want to know the number of weekdays between 17-NOV-2008 to 7-DEC-2008 its 10 excluding sat and sun.
how to do that if the period is more?
like 1-JAN-2006 to 12-APR-2007
Thanks in advance..
Regards,
Manoj
NEXT_DAY(start_date - 1,'SUNDAY') is first sunday >= start_date. NEXT_DAY(end_date - 7,'SUNDAY') is last Sunday <= end_date. Therefore:
(NEXT_DAY(end_date - 7,'SUNDAY') - NEXT_DAY(start_date - 1,'SUNDAY')) / 7 + 1 is number of Sunday's between start_date and end_date. Same way:
(NEXT_DAY(end_date - 7,'SATURDAY') - NEXT_DAY(start_date - 1,'SATURDAY')) / 7 + 1 As a result, number of weekdays between start_date and end_date is:
business_day_count := end_date - start_date + 1 -((NEXT_DAY(end_date - 7,'SUNDAY') - NEXT_DAY(start_date - 1,'SUNDAY')) / 7 + 1 + (NEXT_DAY(end_date - 7,'SATURDAY') - NEXT_DAY(start_date - 1,'SATURDAY')) / 7 + 1) or
business_day_count := end_date - start_date - 1 -(NEXT_DAY(end_date - 7,'SUNDAY') - NEXT_DAY(start_date - 1,'SUNDAY')) / 7 - (NEXT_DAY(end_date - 7,'SATURDAY') - NEXT_DAY(start_date - 1,'SATURDAY')) / 7 or:
SELECT end_date - start_date - 1 -(NEXT_DAY(end_date - 7,'SUNDAY') - NEXT_DAY(start_date - 1,'SUNDAY')) / 7 - (NEXT_DAY(end_date - 7,'SATURDAY') - NEXT_DAY(start_date - 1,'SATURDAY')) / 7 FROM DUAL; The above code assumes business day count between two dates includes both start and end dates. Keep in mind, the above code is NLS dependent.
SY.
Similar Messages
-
How to calculate the number of months between two string as yyyymm
Dear all,
I have two month string like yyyymm e.g. 201003 -- 201105. Now I want to calculate the number of months bertween these two month string? How can I do that? Thanks.888099 wrote:
Hi,
Hope this will help :
public static void main(String[] args) {
Calendar cal1 = new GregorianCalendar(2010, 02, 01);
Calendar cal2 = new GregorianCalendar(2011, 04, 01);
int years = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR);
int months = cal1.get(Calendar.MONTH) - cal2.get(Calendar.MONTH);
System.out.println("number of months : "+Math.abs(years*12 + months));
}Or with only Strings :
public static void main(String[] args) {
String s1 = "201002";
String s2 = "201104";
int years = Integer.valueOf(s1.substring(0,4)) - Integer.valueOf(s2.substring(0,4));
int months = Integer.valueOf(s1.substring(4)) - Integer.valueOf(s2.substring(4));
System.out.println("number of month : "+Math.abs(years*12 + months));
}Edited by: 888099 on 28 sept. 2011 05:49Full code solutions will not help the OP, he will be back here with a different Date question. Posters here try to nudge the OP to figure out the solution himself. -
I wanted to know how do you calculate the number of days between two dates
i wanted to know how do you calculate the number of days between two dates in java ? i get both the dates from the database. i guess there are many issues like leap year and Febuary having diff no of months ..etc.
thanks..
I solve my problem as
public class MyExample {
public static void main(String a[]) {
String stdate = "2009-03-01";
java.sql.Date currentDate = new java.sql.Date(System.currentTimeMillis());
java.sql.Date preDate = java.sql.Date.valueOf(stdate);
System.out.println(currentDate);
System.out.println(preDate);
// int dateCom = preDate.compareTo(currentDate);
// System.out.println(dateCom);
long diff = currentDate.getTime() - preDate.getTime();
int days = (int) Math.floor(diff / (24 * 60 * 60 * 1000));
System.out.println(days);
} -
How to identify the follow up relationship between two service ticket
Hi Folks,
How to identify the follow up relationship between two service ticket ?
Please help me on this...
Regards,
Shashi K, ReddyHi Pepe !
Thank you for the answer, but I dont find this structure ET_DOC_FLOW.....
Please let me know is that structure is correct ......
Regards,
Shashi K, Reddy
shashikumarreddy at gmail dot com -
How to calculate the % of time difference between different state
Hi there,
The below query returns the follwoign outptut. I need to calculate the % of time period that a specific state ( state ex: open or closed or all report )exists.
I have to find the time difference between the 2 states . How could I do that ?
The first row shows null for the previous state . How could get actual previous state for the first row?
SELECT si.station_name,
vppstation.avi_control_state_code.STATE_SHORT_NAME,
ash.state_id ,
lag(ash.state_id) over (order by ash.STATE_EFF_DATE desc) previous_state,
TO_NUMBER(TO_CHAR(ash.state_eff_date, 'SSSSS')) "periods in sec",
TO_CHAR(ash.state_eff_date, 'dd-mon-yyyy hh24:mi:ss am') "Date"
from vppstation.avi_state_history ash
left outer join vppstation.avi_control_state_code
on ash.state_id = vppstation.avi_control_state_code.state_id
LEFT OUTER JOIN vpproadside.stations_installed si
ON ash.station_id = si.station_id
where ash.state_eff_date >= to_date('28/02/2010', 'dd/mm/yyyy')
and ash.state_eff_date <= to_date('03/03/2010', 'dd/mm/yyyy') ;
group by si.station_name
ash.state_id
order by ash.state_eff_date asc ;
STATION_NAME STATE_SHORT_NAME STATE_ID PREVIOUS_STATE periods in sec Date
IRDNCST02 Open 1 NULL 85166 01-mar-2010 23:39:26 pm
IRDNCST02 All Report 3 1 85159 01-mar-2010 23:39:19 pm
IRDNCMT01 Closed 2 3 81376 01-mar-2010 22:36:16 pm
IRDNCST02 Open 1 2 78723 01-mar-2010 21:52:03 pm
IRDNCST02 All Report 3 1 76023 01-mar-2010 21:07:03 pm
IRDNCMT01 Open 1 3 55922 01-mar-2010 15:32:02 pm
IRDNCMT01 Closed 2 1 54931 01-mar-2010 15:15:31 pm
IRDNCHA01 Closed 2 2 41291 01-mar-2010 11:28:11 am
IRDNCAS01 Open 1 2 38847 01-mar-2010 10:47:27 am
IRDNCAS01 All Report 3 1 37947 01-mar-2010 10:32:27 am
IRDNCST02 Open 1 3 35332 01-mar-2010 09:48:52 am
IRDNCST02 All Report 3 1 32632 01-mar-2010 09:03:52 am
IRDNCST02 Open 1 3 31502 01-mar-2010 08:45:02 am
IRDNCST02 All Report 3 1 28802 01-mar-2010 08:00:02 am
IRDNCHI01 Open 1 3 25368 01-mar-2010 07:02:48 am
IRDNCHI02 Open 1 1 23939 01-mar-2010 06:38:59 am
IRDNCMT01 Open 1 1 20696 01-mar-2010 05:44:56 am
IRDNCCH02 Open 1 1 13452 01-mar-2010 03:44:12 am
Edited by: Indhu Ram on Mar 11, 2010 1:34 PM
Edited by: Indhu Ram on Mar 11, 2010 2:20 PMIf you look at the table which is output of the given query , there is column called "STATE_ID" It shows the current state ie open or closed or all report.
The column 'PREVIOUS_STATE' shows the state before the current state. .In the table in 2nd row in previous_state column there is state_id = 1 (open)which is the state before 'all report state' -
How to get the number of days between 2 given dates
Hi all,
How can I find the number of days between any 2 given dates.
ThanksHi
Here's a dirty way:
If you've got two Date objects in Java, call getTime() on each one (which gives you a value in milliseconds), then subtract the two millisecond values, and divide the result by the number of milliseconds in a day (24 * 60 * 60 * 1000). There's more `elegant' ways to do this, but this method only requires one line of Java.
Best wishes
Kevin -
How to Calculate AGE by getting difference between two Date Fields
HI Gems
I need to calculate AGE from getting difference from two date fields. But when i am trying to wrte fromula as Current date - date1(some date field) then it is showing error.
How can i get values.
Thanks
ManuYou already asked this question:
How to calculate AGE from two different date fields -
How to Calculate the Time Between two days in ABAP
Hi,
I have one scenario like i need to calculate the time between two days please can you suggest me.
Thanks,
HarinathHi Peeleti,
Check this code,
DATA : DATE1 LIKE SY-DATUM VALUE '19830125',
DATE2 LIKE SY-DATUM VALUE '20070219',
DAYS1 TYPE I,
WEEK1 TYPE I,
MONTH1 TYPE I,
YEAR1 TYPE I,
C_YEARS1 TYPE I.
CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
EXPORTING
BEGDA = DATE1
endda = DATE2
TAB_MODE = ' '
IMPORTING
DAYS = DAYS1
C_WEEKS =
C_MONTHS = C_YEARS1
C_YEARS = C_YEARS1
WEEKS = WEEK1
MONTHS = MONTH1
YEARS = YEAR1.
D_MONTHS =
MONTH_TAB =
*WRITE : / 'DAYS = ', DAYS1,
/ 'WEEKS = ',WEEK1,
/ 'MONTHS = ', MONTH1,
/ 'YEARS = ', YEAR1.
Using this code you can calculate the No Of Days Between two dates. Based On days you will easily calculate the Hour. [ No of days * 24 ].
Thanks.
Reward If helpful. -
How to calculate the days between last movement of material till today date
Hello Experts,
Could someone help me please?
I have a key figure in the InfoCube 0IC_C03 witch contain the last date of movement of material.
(it is a key figure created in format date and contain the max value).
How can I to calculate the number of days between this date (last movement), till today date (system date).
I need to show:
material........last movement.....days without movements.
xxxxxxxxxxx.....dd/mm/yyyy..........9999
Im trying to do this calculation in bex using variable formula but it doesn't work becouse current date (customer exit) brings sy-datum in format yyyymmdd and the kf-last-mov is in format number (I dont know what kind of number)
Thanks in advance,
Points are assured.
Regards,
Silvio Meurer.
Message was edited by:
Silvio MeurerHi Parth,
Here we are using the version 7.0 and SP 10, I'm afraid I could not understand you. I Can't find the function DATE_DIFF (Where is it?)
I'm using the formula and it doesn't work. Coud you see the result is:
last movement date Today date result
02.04.2007 20.070.625 19.337.856
18.05.2007 20.070.625 19.337.810
the "today date" is from customer exit and the result is a strange number to me.
Could you help me? -
How to Calculate the Space between two Characters in GDI + ?
I am Drawing the set of characters in Graphics, by Calculating the points using GraphicsPath for each Character. I Need to know how to calculate the distance should be given between the two characters?
I am using this code to generate points
PointF [] pnts;
var p=new GraphicsPath();
path.AddString("A","Arial",(int)FontStyle.Regular,50,new pointF(0f,0f),StringFormat.GenericDefault);
Matrix m=new Matric(1,0,0,1,0,0);
path.Flatten(m,1,0f);
pnts=path.pathpoints;
i am getting the points for all characters using the above code.
Now i am combining the two character Using the points generated by the above code. Eg "AB"
Help me to calculate the the character space should be given between two characters?
Thanks in Advance...Hi,
this link can assist you:>
Professional C# - Graphics with GDI+
Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP] -
hello everyone,
i'm rai from indonesia
I have a final project about pulse oximetriy, I have some problems,
how to calculate the ratio between the maximum and minimum peaks of the two waves using two while loops to calculate SpO2 ?
My program image can be seen below predicament ?
Attachments:
spo2 akusisi data with filter lpf hpf smoot nilai max min ir merah.vi 249 KB
spo2 akusisi data with filter lpf hpf smoot nilai max min ir merah.vi 249 KBHi rai,
I would appreciate it as kind of respect for forum participants if you would clean up your VI before uploading it (or images of its block diagram)…
That being said:
- Your inner while loops each run exactly twice. Replace them with FOR loops!
- Lots of unneeded operations, mainly induced by ExpressVI usage. Is there a reason to convert to DDT and immediately convert back to 1D array?
- You already calculate some Min/Max values. Ratio is just a division of two values…
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
hello everyone,
i'm rai from indonesia
I have a final project about pulse oximetriy, I have some problems,
how to calculate the ratio between the maximum and minimum peaks of the two waves using two while loops to calculate SpO2 ?
My program image can be seen below predicament ?
Attachments:
spo2 akusisi data with filter lpf hpf smoot nilai max min ir merah.vi 249 KBHi Rai,
You should post this into the LabVIEW forum rather than Real-Time since this isn't a Real-Time application. Your post will see more replies in the LabVIEW forum.
As far as your question is concerned, you can write the max and min from the respective loops to a local variable to send the data out of the loops to a third loop or just do the calculation in one of the loops. This would be ideal if you're trying to do this while the loop is running.
-Jayk
Applications Engineering
National Instruments -
How to calculate the hour difference between two dates?
hi all,
how to calculate the hour difference between two dates?
eg i trying this...
((TO_DATE(TO_CHAR(GRNi.reference_date_4,'hh24:mi'),'hh24:mi') -
TO_DATE(TO_CHAR(NVL(GRNi.reference_date_3,SYSDATE),'hh24:mi'),'hh24:mi'))*24)*60 Act_Hr
Reg.
AAKHi
To break the diff between 2 dates into days, hours, minutes, sec -- you can use the following:
select to_char( created, 'dd-mon-yyyy hh24:mi:ss' ),
trunc( sysdate-created ) "Dy",
trunc( mod( (sysdate-created)*24, 24 ) ) "Hr",
trunc( mod( (sysdate-created)*24*60, 60 ) ) "Mi",
trunc( mod( (sysdate-created)*24*60*60, 60 ) ) "Sec",
to_char( sysdate, 'dd-mon-yyyy hh24:mi:ss' ),
sysdate-created "Tdy",
(sysdate-created)*24 "Thr",
(sysdate-created)*24*60 "Tmi",
(sysdate-created)*24*60*60 "Tsec"
from all_users
where rownum < 50
HTH
RangaReddy -
Hi All,
Please have a look in to the below mentioned environment.
primary site :SITE 1
server 1
server 2
secondary site :SITE 2
server 3
Note : All the above three servers are in single DAG .All the database are mounted on the server (server 1) which is located in the primary site (I.E SITE 1).
On that 5 databases we are having 3500 users .Based on the user designation we have allocated the mailbox size.
Query : Each and every day we are having the large no copy queue length for all the five databases to the server located in SITE 2.
Please help me out on this and also tell me is there any tool available to exactly get the required bandwidth for the exchange servers located between the active directory sites.
Thanks & Regards S.NithyanandhamI don't know of any tool that can calculate things for you but latency is the biggest thing you have to worry about. The other issues is looking at the network gear between the 2 sites. I have seen many times were switches get maxed out if they are set to
1 GB or even ports getting maxed out and need to bonded for more throughput. Test your latency from the edge of each site then test it within to see if there is a difference.
Regardless of their geographic location relative to other DAG members, each member of the DAG must have round trip network latency no greater than 500 milliseconds between each other member.
As the round trip latency between two Mailbox servers hosting copies of a database increases, the potential for replication not being up to date also increases. Regardless of the latency of the solution, customers should validate that the networks between
all DAG members is capable of satisfying the data protection and availability goals of the deployment. Configurations with higher latency values may require special tuning of DAG, replication, and network parameters, such as increasing the number of databases
or decreasing the number of mailboxes per database, to achieve the desired goals.
Round trip latency requirements may not be the most stringent network bandwidth and latency requirement for a multi-datacenter configuration. You must evaluate the total network load, which
includes client access, Active Directory, transport, continuous replication, and other application traffic, to determine the necessary network requirements for your environment.
http://technet.microsoft.com/en-us/library/dd638104(v=exchg.150).aspx
DJ Grijalva | MCITP: EMA 2007/2010 SPA 2010 | www.persistentcerebro.com -
Hello everyone ,
I need a quickly help that as below :
I am trying use PCI-6220 to acquired six signals from one rotation encoder (channel A, channel B,channel Z ,and their non-signals) .The encoder out signals will be square wave and 4000pulses per revolution. I set it rotation at 300rpm speed. I need show every square wave of six out channels in waveform and measure the A-B phase difference to check if the value is correct (designed value should be 90deg) .
I have no idea how to measure or calculate the phase difference of two square wave base on synchronizate to acquire these two square wave from two channel on the PCI-6620....
Anyone can give a idea how to calculate the phase difference with two square wave ?
Thank a lot and Thanks again...
TimTim,
Here is a simple rising edge detector for one channel.
Lynn
Attachments:
Rising edge.vi 15 KB
Maybe you are looking for
-
Importing animated photoshop layers to FCPX
I have reworked and saved all my files in FCP 7 including some multilayered animated Photoshop files in order to be able to finally export my project into FCP X - I have exported the file as Apple xml Interchange and than used the 7toX transfer app t
-
Trouble with locked/read only files and folders
After reinstalling OSX I have an external harddrive with locked files and folders. I´ve heard that it is possible to unlock all files and folders from Terminal (it will take hours to unlock manually). Anyone who knows a script that will set read and
-
Hi all I am tring to install oracle RAC in Windows 2003 srver.I have creared 2 virtual pc.I follwed every step correctly coz the clusterware software installs upto vipca.After that i sudelny see a blue screen stating that the hardware failure .Now i
-
Network behind a router ,,,concept of behind
I have got Router55 in a diagram , it has BRI0/0 connection to ISDN cloud, and S0/0 connection to frame relay cloud, and E0/0 to LAN and E0/1 to another router BB If a question ask : "Configure your network(mean configure R55) so that ICMP traffic is
-
How do I install CS4 on other computer without disks?
I was overseas when I purchased CS4 via a download and installed it on my laptop. I now want to install it on my desktop at home in the US, but I'm puzzled as to how best to go about doing this because I only have some files on my laptop from the or