How to calculate the days with a date field
I need to make a query that shows the number of flown days at the end of the month for the whole fleet, given a date that represents one day within that month.
I would appreciate all the help I can get
thanks in advance
Hi,
I am not sure if I interpreted your question correctly, but are you looking for counting for number of days between two days?
If yes, see if the following example query helps you.
SQL>select to_date('30-Jun-2003') - to_date('30-May-2003') from dual
- this returns 31.
If not, could you please give more details of your requirement with an example?
-Savitha.
Similar Messages
-
How to add 2 days to a date field?
How to add 2 days to a date field if a Saturday was selected on a different date field?
ThanksI am attempting to add a date field and then have a another field add an amount to a box if the date is less than 30 days. Later I want to update the form to have the today's date is less than 10 days.
Early Registration Fee is $10.00 if posted by February 25, 2008
Late Registration Fee is $20.00 if posted by March 17, 2008
It seems simple, but, when you get to be 71 years old, it seems difficult. Any help will be appreciated.
Here is a link to the form I'm working on:
http://www.aworldwide.com/Gideon/Convention_Registration.pdf
I am using a trial version of Adobe Acrobat 8.
Thanks,
Andy Anderson -
How to calculate AGE from two different date fields
hi
I need to calculate AGE from two different date fields.
Can some help me how to do, when i try to do substraction formula it is showing error.
Thank You
ManuManu wrote:
Hi
Both fields are in date format only, i need to calculate no . of days between two different dates
Thanks
ManuThe reason for the question about the format of the column is because the simplest solution only works on DATE columns. Others have mentioned this here, but if you want the difference between two date fields, you can use this formula:
TIMESTAMPDIFF(SQL_TSI_DAY, date_column1, date_column2)
The above being said, you still didn't tell me what you did, or what error message you received. So again, if the above formula didn't work, what did you do? Where did you put the formula? What was the exact syntax you used? What was the error message you got?
Please don't make us work more than we need to. Answer all the questions in your next post. Thanks. -
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 create a group with multiple data fields
Post Author: RichS
CA Forum: Formula
Using CR XI. Using CSV input from ODBC text driver. No problems here.
There are 3 fields that I want the same group by action. Is this possible?)
If any one of these 3 fields change I want some header information and column fieldnames to display. The header information I only want displayed on the first page (on the change) and the column fieldnames to display on every page. I have played around with things like "InRepeatedGroupHeader" and "report group header on each page". I am not getting all the results that I am looking for though.
I want report to look like:
Page header stuff (to display on every page) This data consists of some fields that will have static data and will display on every page. And it consists of 3 non-static fields that I want to group on.
Group header stuff that I only want displayed on the first page on a change from one of the 3 fields mentioned above.
Column headings that I want displayed on every page.
Details data
Group footer stuff (details not important for this)
I get the expected output (column headings displayed on every page, and group header stuff display on the first page on each group change) with one group field. But I want the group change to happen for all 3 fields.
It seems simple but I can't find a way to create a "group" so if "field1 or field2 or field3" change, I get the same "group by" action. I just need to know how to get the expected action.
I expect that I might have some terms mixed up and/or some important information that would aide you in helping me. If that is the case please re-post and I will add any missing or mis-stated information.
Thanks,Post Author: V361
CA Forum: Formula
I am slightly confused, but perhaps you can create a formula
Then group on the formula. If this is not what you want, could you post some sample data, with the desired results. -
How to Add 20 days to a date field
Dear All,
I am struck badly on Date manipulation. If somebody has any ideaz on this let me know.
I want to add some amount of days to system date and then compare it with another date.Hi capo9999!
There are two class to easy and fast manipulate date variables: Calendar and GregorianCalendar.
You must to read documentation about because there are many details to consider. Date variables has a special structure and do not confuse with "Date class" wich can be used with Calendar and GregorianCalendar.
An example:
Calendar today = new GregorianCalendar(); or
Calendar now = Calendar.getInstance();
create a new date structure with current date and to manipulate these variables there are methods to add an amount to components. Another example:
now.add(Calendar.DAY_OF_MONTH, numDays);
It's amazing to work this way.
Best Regards. -
How to calculate the size of a Text Field?
Is there a way to calculate the number of characters allow in a Text Field? If a uer type over this number of characters a popup window will appear telling the user that he/she has too much texts. Of course I could use the Limit Length, but I have to manually put texts into this text field and count them. If the Limit Lenth number is too small, the texts does not fill the whole text field. If the number is too big then the texts does not get printed.
There would be no easy way to do this. You'd need to do some pretty fancy calculations, it would all depend on the size of the field, what font is used, the font size, whether it's been bolded, underlined, italicized, etc etc.
What are you trying to accomplish? Make it so that the user can type in the text field until it fills and then have it stop without scroll bars coming up to allow him to keep typing?
Chris
Adobe Enterprise Developer Support -
How to calculate the difference between two dates?
Hello,
I would like to write some code which figures out how many days are between the Date_of_change (which is of datatype DATE, length 7 and of format DD-MON-YY) and the current date today. Then if the difference between Date_of_change and the current date is greater that 30 days for example then I would like to delete that record from the database.
Thanks
DougSomething like this should work:
SQL> select * from emp order by hiredate ;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7934 MILLER CLERK 7782 21-OCT-2005 1300 10
7902 FORD ANALYST 7566 22-OCT-2005 3000 20
7900 JAMES CLERK 7698 23-OCT-2005 950 30
7876 ADAMS CLERK 7788 24-OCT-2005 1100 20
7844 TURNER SALESMAN 7698 25-OCT-2005 1500 0 30
7839 KING PRESIDENT 26-OCT-2005 5000 10
7788 SCOTT ANALYST 7566 27-OCT-2005 3000 20
7782 CLARK MANAGER 7839 28-OCT-2005 2450 10
7698 BLAKE MANAGER 7839 29-OCT-2005 2850 30
7654 MARTIN SALESMAN 7698 30-OCT-2005 1250 1400 30
7566 JONES MANAGER 7839 31-OCT-2005 2975 20
7521 WARD SALESMAN 7698 01-NOV-2005 1250 500 30
7499 ALLEN SALESMAN 7698 02-NOV-2005 1600 300 30
7369 SMITH CLERK 7902 03-NOV-2005 800 20
14 rows selected.
SQL> delete from emp where hiredate < sysdate - 30 ;
10 rows deleted.
SQL> select * from emp order by hiredate ;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 31-OCT-2005 2975 20
7521 WARD SALESMAN 7698 01-NOV-2005 1250 500 30
7499 ALLEN SALESMAN 7698 02-NOV-2005 1600 300 30
7369 SMITH CLERK 7902 03-NOV-2005 800 20
4 rows selected.
SQL> -
How to extract the record with latest date
in internal table i a have 10 records, in that for each record only date is changing...so,now the issue is i should extract the record which having the latest date
try this code -
data: begin of itab occurs 0,
name(20),
add(20),
bp like sy-datum,
end of itab.
itab-name = 'aaa'.
itab-add = '123'.
itab-bp = '20061220'.
APPEND ITAB.
CLEAR ITAB.
itab-name = 'bbb'.
itab-add = '123'.
itab-bp = '20061219'.
APPEND ITAB.
CLEAR ITAB.
itab-name = 'aaa'.
itab-add = '123'.
itab-bp = '20061222'.
APPEND ITAB.
clear itab.
sort itab descending by bp.
read table itab index 1.
write: itab. -
How to calculate Average time from a date field
Hi All,
I have a date type field in my table .
I want to calculate average time for a given country in a select query. Date has to be exculded. Only time has to be taken into consideration.
Kindly help me.
Sample data
india 25-JUN-09 08:12:45
india 25-JUN-09 09:01:12Take which one you want.WITH dates AS
(SELECT sysdate x FROM dual
UNION
SELECT sysdate + 1 +1/24 FROM dual
SELECT TO_CHAR(to_date(AVG(to_number(TO_CHAR(to_date(TO_CHAR(x,'HH24:MI:SS'),'HH24:MI:SS'),'sssss'))),'sssss'),'hh24:mi:ss')
FROM dates;
WITH dates AS
(SELECT sysdate x FROM dual
UNION
SELECT sysdate + 1 +1/24 FROM dual
SELECT floor(24 * AVG(x- TRUNC(x)))
|| ':'
|| floor(mod(24 * AVG(x- TRUNC(x)),1) * 60)
|| ':'
|| floor(mod(mod(24 * AVG(x- TRUNC(x)),1) * 60,1) * 60)
FROM dates;By
Vamsi -
How to change the format of a date field inheriting format from subclass.
Currenctlty date filed is inheriting the format from a property class. The date format in my property class is 'dd/mm/rrrr'.
Now my requirement is to change the format mask according to my applications user from 'dd/mm/rrrr/ to 'dd/mon/rrrr'.
Some may use 'dd/mm/rrrr' and some may use 'dd/mon/yyyy'.
Thanks.Some may use 'dd/mm/rrrr' and some may use 'dd/mon/yyyy'.
I want a generic solution to change the date format at runtime These two seem to conflict. How will you decide which one to change and which not? -
Calculate the Difference Between two dates excluding weekends and Holidays
Hi,
We need to calculate the difference between the two dates by excluding the Local public holidays (It is global and varies across countries) and weekends should not be included in calculation for a business day in OBIEE.
We have two dates: Open date and close date when ever close date is null we are calculating age based on taking the current timestamp and need to exclude the weekends and Holidays when ever the close date is null.
Ex:
Col1 col2 Total
11/9/2010 2:46:38 PM Null 13
11/2/2010 8:06:26 PM 11/3/2010 5:37:03 PM 1
(In the Total we shouldn't include the weekends,holidays)
Please let me know how to calculate the difference between two dates by excluding the weekends and holidays.
Thanks
Edited by: user10441472 on Nov 22, 2010 3:14 PMYou already asked this question and I answered it...
Re: calculation of Business day in OBIEE -
Calculate the Difference between 2 dates
Please let me know how to Calculate the Difference between 2 dates in Time Management. I have a hire date(U1) and adjusted Service Date(B2)
I need to Find out the number of Years, Days and Months between these 2 dates
Thanks a lot in AdvanceHi Rahul,
You can take a look at the standard function 'HR_HK_DIFF_BT_2_DATES' and see if it suits your need.
Regards.
Francis -
Working days between two date fields and Changing Factory Calendar
Hi,
I have to calculate working days between two date fields excluding the weekends and public holidays for Switzerland.
I have written the routine using factory calender and its working fine except for two problems now:
1. If any one of the date field is empty then teh rsult should be zero.
2. And the below code is working from 1996 but my cleints wants it to work for years before 1996 as well.
I also tried to change the Start date in SCAL for factory calendar but it says enter values between 1995 to 2020.
I am new to ABAP. Please help me how i can achieve these for below code.
DATA: IT_HOLIDAYS type TABLE OF ISCAL_DAY,
IS_HOLIDAYS TYPE ISCAL_DAY.
DATA: T_DATE TYPE SY-DATUM,
P_DATE TYPE SY-DATUM.
DATA : X_DATE(4) TYPE C.
DATA: CNT TYPE I.
REFRESH : IT_HOLIDAYS.
CLEAR : IT_HOLIDAYS.
T_DATE = SOURCE_FIELDS-/BIC/ZCCCHP812.
P_DATE = SOURCE_FIELDS-/BIC/ZCCCHP810.
CALL FUNCTION 'HOLIDAY_GET'
EXPORTING
HOLIDAY_CALENDAR = 'CH'
FACTORY_CALENDAR = 'CH'
DATE_FROM = P_DATE
DATE_TO = T_DATE
TABLES
HOLIDAYS = IT_HOLIDAYS
EXCEPTIONS
FACTORY_CALENDAR_NOT_FOUND = 1
HOLIDAY_CALENDAR_NOT_FOUND = 2
DATE_HAS_INVALID_FORMAT = 3
DATE_INCONSISTENCY = 4
OTHERS = 5.
DESCRIBE TABLE IT_HOLIDAYS LINES CNT.
X_DATE = T_DATE - P_DATE - CNT.
RESULT = X_DATE.
Please help
Regards
Zabina
Edited by: Syed786 on Nov 2, 2011 9:15 AMHi Zabina,
Try this function module 'DURATION_DETERMINE'.
Give the factory calendar and unit as DAY
With regards,
Rajesh -
How to get the difference of two dates in years,months and days
Hi friends,
how to get the difference of two dates in years,months and days
for ex 2 years 3 months 13 days
select (sysdate-date_Start) from per_periods_of_service
thanksSomething like this...
SQL> ed
Wrote file afiedt.buf
1 with t as (select to_date('17-nov-2006','dd-mon-yyyy') as c_start_date, to_date('21-jan-2008','dd-mon-yyyy') as c_end_date from dual union all
2 select to_date('21-nov-2006','dd-mon-yyyy'), to_date('17-feb-2008','dd-mon-yyyy') from dual union all
3 select to_date('21-jun-2006','dd-mon-yyyy'), to_date('17-jul-2008','dd-mon-yyyy') from dual
4 )
5 -- end of test data
6 select c_start_date, c_end_date
7 ,trunc(months_between(c_end_date, c_start_date) / 12) as yrs
8 ,trunc(mod(months_between(c_end_date, c_start_date), 12)) as mnths
9 ,trunc(c_end_date - add_months(c_start_date, trunc(months_between(c_end_date, c_start_date)))) as dys
10* from t
SQL> /
C_START_D C_END_DAT YRS MNTHS DYS
17-NOV-06 21-JAN-08 1 2 4
21-NOV-06 17-FEB-08 1 2 27
21-JUN-06 17-JUL-08 2 0 26
SQL>But, don't forget that different months have different numbers of days, and leap years can effect it too.
Maybe you are looking for
-
Adobe Reader 9.4.6 has taken out my printer drivers
On 12/14/11 I was on my Windows 7 based system when i was sent a pop up window query asking me if I wanted to upgrade to Adobe Reader 9.4.6 I had an earlier version and I get prompts of this nature all the time, so I said yes. Download was protracted
-
Get path from string in an column
I have an data with text and url. I need to seprate the url only in the column and display in sql query Need to get data after Url: and the next immediate " " {blank space} my data is like below seach engine Url: www.bing.com this is the world famous
-
Error Log in APEX 4.0.0.2 for Importing of Applications
I am trying to find the error log that will show me errors that happen when trying to import an application. I have seen some errors in the past but think we fixed those. Our change management team thinks they are back but didn't do a screen shot. Is
-
My Photoshop CS6 is not responding.
My Photoshop CS6 is not responding when opening. What should I do. thanks.
-
Determine database character set
How do I determine the database character set? Can look into v$parameter and v$system_parameter for NLS settings, but need to know the database character set. I am following other DBAs so I don't have the creation scripts. Am supporting databases fro