Calculate n in present days in a month
HelloI have the column date of count No.. days.if worked, I use count function, it returns the columns.how mutiple values to calculate n. present days in a month
Hello
Please me like the below,
SELECT count (gdh.work_date) expenditure_item_date xx_timesheet_ln gdl, gdh timesheet_hdr
WHERE gdl.dt_header_id = gdh.dt_header_id
and employee_number = 34
"expenditure_item_date" is a column alias or real column?
You can try this
SELECT count(gdh.work_date) FROM xx_timesheet_ln gdl, timesheet_hdr gdh
WHERE gdl.dt_header_id = gdh.dt_header_id
and employee_number=34
or
SELECT employee_number,count(gdh.work_date) FROM xx_timesheet_ln gdl, timesheet_hdr gdh
WHERE gdl.dt_header_id = gdh.dt_header_id
group by employee_number
any employee for basic
See you soon
Kanchana
Tags: Database
Similar Questions
-
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;
}
-
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.
-
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... -
Calculate fees that pay based on the number of days in a month
Hello
I'm writing the BR to fresh wages, based on the number of days in the month.
Fix(Jan:DEC)
"Salary" = ("Annual salary"-> "BegBalance" / 12) * "workforce";
The existing calculation was ' wages divided by months no .of (12) ", now instead of number months wages that need to be calculated ("BegBalance"/ No..) OF DAYS IN THE MONTH) * 12.
Can someone pls guide me, how to begin writing the BR for 'No. DAYS OF THE MONTH.
You can do an admin enter number of days in the month. I remember CL reminding me the rhyme thirty days has September - Wikipedia, the free encyclopedia
Jokes aside, you can use SQL to get the number of days. You will get different options for SQL and Oracle.
If you want to continue to do this in BR then
Fix(Jan:DEC)
IF (@ISMBR (SEP) OR @ISMBR (Apr) OR @ISMBR (Jun) OR @ISMBR (Nov))
("Salary" = ("annual salary"-> "BegBalance" / 30) * 12) * "workforce";
ELSEIF (@ISMBR (Jan) OR @ISMBR (Mar) OR @ISMBR (May) OR @ISMBR (July) OR @ISMBR (Aug))
("Salary" = ("annual salary"-> "BegBalance" / 31) * 12) * "workforce";
ELSE (@ISMBR (Feb))
IF (@Remainder($CurrYr/4) == 0)
("Salary" = ("annual salary"-> "BegBalance" / 29) * 12) * "workforce";
ON THE OTHER
("Salary" = ("annual salary"-> "BegBalance" / 28) * 12) * "workforce";
ENDIF
ENDIF
ENDFIX
Concerning
Celvin
Post edited by: CelvinKattookaran
-
1st day of the month to the current date
Hello
I have a requirement I want to calculate
Today's date
1st day of Feb
Jan, 1st day
----
----
March 1
month must contain only day 1 must not display 2 or 3... 31. only 1 of each must display
If the potential revenues are added to the fact pass
ex
Jan 21 100
Jan 21 200
Jan 31 300
Feb. 1 needs to be jan2nd + January 3 +... 31st .jan
all can help me please
Published by: 935667 on February 5, 2013 02:46Hello
In your column of date you can try to use the formula below to achieve what you are looking for:
TIMESTAMPADD (SQL_TSI_MONTH, 1, TIMESTAMPADD (SQL_TSI_DAY, (DAYOFMONTH ("YourDateColumn") *-1) + 1, 'YourDateColumn'))
This will give you the first day of the next month. For example for Jan 1, Jan 2.Jan 31, the date column would show on Feb. 1.
Thank you
Hyder -
Query or logic to find several days through each month.
Dear friends,
I need your help to solve this problem.
We have a now where we have to pay compensation to the employees based on their number of working days.
Say, for example, if an employee has worked since March 3, 2012-April 5, 2012.
We have a fixed value for a month 300 dirhams. But the number of days on s March 31 and number of days in the month of April are 30.
So by compensation daily for March day would be 300/31 and April would be 300/30.
We are looking for a logical opr query that calcluates first right number of days in each month (per month) and then calculate as below
Number of working days in the month of March is 31-3 + 1 = 29
Compensation of A1 = (300 * 29) / 31
Number of working days in the month of April is 5 (must also find logical I guess)
Allowance for A2 = (300 * 5) / 30
Then A1 + A2.
(E) would be the total quota when the number of months in all.
Please guys any help would be greatly appricated.
RJust a follow-up ;-)
Note that you can almost get what you want with standard MONTHS_BETWEEN function [url http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions102.htm#i78039].
But notice this quote from the documentation:>
If date1 and date2 are the same days of the month or the last two days of the month, the result is always an integer. Otherwise the Oracle database calculates the fractional part of the result based on a month of 31 days and consider the time difference components date1 and date2.
>It will always use one even if 31 days a month has fewer days.
Then you could also implement the logic of my previous answer as your own function months_between implementation:
create or replace function my_months_between ( p_todate date , p_fromdate date ) return number is begin return ((extract(day from last_day(p_fromdate))-extract(day from p_fromdate)+1) / extract(day from last_day(p_fromdate))) + (months_between(trunc(p_todate-1,'MM'),trunc(p_fromdate,'MM'))-1) + (extract(day from p_todate-1) / extract(day from last_day(p_todate-1))); end my_months_between; /
I changed it to make it "compatible" with the standard function that it calculates up to but not including the parameter to date (which is correct when you are considering dates with time included, but I guess in your case, you have just date values.)
Then, you can compare the results of the standard months_between with the new my_months_between:
(Note that I have call the functions with the d2 + 1 to give the desired result of inclusion and to this day in the calculation).SQL> with testdata as ( 2 select date '2012-03-03' as d1, date '2012-04-05' as d2 from dual union all 3 select date '2012-02-03' as d1, date '2012-05-02' as d2 from dual union all 4 select date '2012-03-03' as d1, date '2012-03-10' as d2 from dual union all 5 select date '2012-03-01' as d1, date '2012-07-31' as d2 from dual union all 6 select date '2012-02-01' as d1, date '2012-03-01' as d2 from dual union all 7 select date '2012-01-01' as d1, date '2012-03-25' as d2 from dual 8 ) 9 -- 10 -- end of test data -- 11 -- 12 select months_between(d2+1, d1) std_months 13 , 300 * months_between(d2+1, d1) std_allowance 14 , my_months_between(d2+1, d1) my_months 15 , 300 * my_months_between(d2+1, d1) my_allowance 16 from testdata 17 / STD_MONTHS STD_ALLOWANCE MY_MONTHS MY_ALLOWANCE ---------- ------------- ---------- ------------ 1.09677419 329.032258 1.10215054 330.645161 3 900 2.99555061 898.665184 .258064516 77.4193548 .258064516 77.4193548 5 1500 5 1500 1.03225806 309.677419 1.03225806 309.677419 2.80645161 841.935484 2.80645161 841.935484 6 rows selected.
For a large part of the data, both give the same result, especially when the two dates are in month of 31 days.
To work from ' 2012-03-03' to '' 2012-04-05 standard service gives too little because it uses always 31 days, while my_months_between uses 30 days of April."But note working from '' 2012-02-03 to 2012 - 05 - 02. He jumped 2 days in February and has worked 2 days in May - the standard function concludes he works precisely 3 months.
But my_months_between computes fraction 27/29 months in February, then March and April like 2 months, and then the fraction 2/31 months in May - which gives a total of 2.99555061 instead of 3 months.Just something to be aware of ;-)
-
Dear members,
I have available dates,
Let's say date1 = January 1, 2011"
and date2 = April 15, 2011"
My goal is to calculate the sum of the no. of days between this range.
i.e.
month = 01 days = 22
month = 02 days-28
month = 03 days = 31
month = 04 days = 15
so total days = 22 + 28 + 31 + 15 = 96 between individuals because of the date range.
My goal is to have the figure 96 days that is the sum of the days of the month.
Kind regards
Teefu
Developer
Published by: teefu on July 21, 2011 10:09Hello
If all you want is the total number of days, then you can simply subtract the earlier DATE of the last one, like this:
SELECT TO_DATE ( '15-04-2011' , 'DD-MM=YYYY' ) + 1 - TO_DATE ( '10-01-2011' -- Jan. 10; '01-10-' would be Oct. 1 , 'DD-MM-YYYY' ) AS days_diff FROM dual;
If you want to see a breakdown by month, here's one way:
WITH parameters AS ( SELECT TO_DATE ( '10-01-2011' , 'DD-MM-YYYY' ) AS start_dt , TO_DATE ( '15-04-2011' , 'DD-MM-YYYY' ) AS end_dt FROM dual ) SELECT TO_CHAR ( start_dt + LEVEL - 1 , 'FMMonth YYYY' ) AS month , COUNT (*) AS days FROM parameters CONNECT BY LEVEL <= 1 + end_dt - start_dt GROUP BY TO_CHAR ( start_dt + LEVEL - 1 , 'FMMonth YYYY' ) ORDER BY MIN (LEVEL) ;
Output:
MONTH DAYS -------------------- ---------- January 2011 22 February 2011 28 March 2011 31 April 2011 15
Published by: Frank Kulash, July 21, 2011 01:10
-
I have created a form with 2 date objects:
"Date1" is a date object in which the user will enter the first day of a month gave "MM/DD/YYYY";
I need "Date2" to calculate the last day of the month of 'Date1' ' MM/DD/YYYY ".
Obviously, the date displayed in Date2 will vary, because months contain a different number of days, so I can't just say '+ 30 '. Can someone help me with a JavaScript for the FomCalc code to achieve this?
Thank you!!!
Gene-O
Maybe you're view model is different from the trend in the script.
Here is an example of work form:
-
Day of the month Dimension or is there another way?
I was asked to create a cube that contains data at the granularity of a day. For example, the daily sales. However, Essbase does not allow duplicate member names. I built temporarily an additional dimension of day of the month to allow the loading of the data, but the presentation to users is a little awkward using Smart View in Excel as they expected data rollup by date. Anyone is attacked in a similar project? Thank you.I would not create a dimension of day. I did several cubes 'daily' in my career. A good question to ask yourself is "turning back is really important daily detail?" For each project every day that I did, this response is in the ballpark of two or three months... and no more. So what I did was to create a rolling cube of two months (or three) with separate daily details (put in the alias and refreshing dates by load rules then roll to a new month.) This cube balances with the same two months in the full year monthly retail only cubes. I did my first one before there was the partitioning or @XREF so now you have options to connect these cubes. Even if you load the monthly cube full year directly, it might be interesting to create a "related" partition so that users can jump from the current month or the month before, for example, in the year cube full in the daily details expanded in the daily cube.
If it turns out a full year of daily detail is necessary (although I doubt it is the need in an OLAP model given the possibilities for extracting relational retail uses the EIA or Essbase Studio depending on your version), then ASO would be my choice to handle the extra volume. Otherwise, I'm talking about BSO. I hope you find it useful.
Sincerely, Darrell Barr
PS - don't forget that you can activate duplicate names if you are on the latest versions of the product (although I don't really recommend it).
-
BEEP Scheduler - last day of the month
Is there a a way to schedule reports to run on the last day of the month using the Scheduler of BEEP? I see that I can choose to run the monthly report and I choose the day to run it, but the last day of the month is different from one month to the other most of the time. Is it possible to do so in the Scheduler?
Thank you!Oops, my bad,
I did not review the request clearly.There is possibility to plan the report, because every month and he asks date of the month.
If you register 31, his is not going to run it for each month, since used 31 are present in every month.Note: And there is no provision in the bi-editeur before you do :), front-end Bi Publisher accuses this support.
You can use WebService at fire report every end of month :), but if you seek support front end 'calendar' homepage, start SR.As far as I know, its a bug, please contact technical support and connect a SR and let me know of the State.
-
How to get the maximum number of days in a month?
How to get the maximum number of days in a month?
I use a dateField. where I can get the month. Now, I want to get the maximum number of days in a month.
How can I get it?
Please help me. and thanks in advance... []
NET. RIM. Device.API.util
Class DateTimeUtilitiesgetNumberOfDaysInMonth (int month, int year)
Returns the number of days in the specified monthIt took me like 10 seconds to find it in the API, I guess you spent more time writing the post...
-
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...
-
query for the first day of the month
Hi all
How to get the first day of the month in the sql query.
SQL> select trunc(sysdate,'mm') first_day from dual; FIRST_DAY --------- 01-AUG-15 SQL> select trunc(sysdate,'month') first_day from dual; FIRST_DAY --------- 01-AUG-15 SQL> select trunc(sysdate,'mon') first_day from dual; FIRST_DAY --------- 01-AUG-15 SQL>
-
How to find the first day of the month following two years one year from now?
Hello
I need to find the first day of the month following two years ago, based on the current date.
For example: If today is the 31/08/2015 so I need to find the date range between 31/08/2015 and on 09/01/2013. How can I write an SQL which allows to automate this calculation instead of hard-coding the values. Please do help me out with this so that I can build the SQL that can produce the desired result.
Thank you
Dhilip
find the start of the month - 2 years in advance, early - 2 years + 1 months in advance and go back 1
Select trunc (add_months(sysdate,24), 'MM'), trunc (add_months(sysdate,25), 'MM') - 1 double;
Maybe you are looking for
-
Fans not correctly detect when you present to the RPM
Why my 13 "2015 MB Pro fan not totally crank when the cpu temperature is like 100ᴼ? For example my CPU Core 1 is 80ᴼC and my Core 2 CPU is 100ᴼC, my GPU Core even 78ᴼC yet the rest fan 1300 rpm, whereas at this stage at 4000-6000 RPM. Is it because I
-
Apple have an eta on when the App Store will be running again
LLooking fofor an eta for the App Store being upwards and will again
-
Equium A60-181 more problems.
Well, I decided to update my BIOS to 1.90 summer saw questionswith firewire port, however, this has not cured the problem I vemet (see section flakey firewire...).I'm not really all that bothered I put t need firewire, but itlook just odd having yell
-
I'm trying to work my friends computer to install Java
but when he went to then install, it says the program path: C contained an invalid character, since then, I have tried to change the destination folder, but it still says the same message, any guy for advice? Thank you
-
volume and battery meter icons have disappeared from the taskbar. How to make a comeback?