Want to display difference between two datetimes
I want to display difference between time in the below format
for example for below two dates
select to_date('02-feb-2011 23:55:55','dd-mon-yyyy hh24:mi:ss') date1 , to_date('03-feb-2011 00:35:00','dd-mon-yyyy hh24:mi:ss') date2 from dual;
00:45:05
Edited by: Sun Vth Oracle on Feb 9, 2011 2:09 AM
00:45:05Really?
I get:
SQL> with t as (
2 select to_date('02-feb-2011 23:55:55','dd-mon-yyyy hh24:mi:ss') date1
3 , to_date('03-feb-2011 00:35:00','dd-mon-yyyy hh24:mi:ss') date2
4 from dual
5 )
6 --
7 --
8 --
9 select numtodsinterval(date2 - date1, 'day')
10 , substr(numtodsinterval(date2 - date1, 'day'), 12, 8 )
11 from t;
NUMTODSINTERVAL(DATE2-DATE1,'DAY') SUBSTR(N
+000000000 00:39:04.999999999 00:39:04
Similar Messages
-
To calculate the difference between two periods in SSM
Hi,
I have two questions need to be clarified.
Question 1: I have KPI named Revenue growth and the formula to calculate is (current year revenue - previous year revenue).I am using data entry& approval.Is that technically possible to calculate the revenue difference between two periods in SSM?
Question 2: Is that possible to enter the date as input for the variable?for example i want find the difference between two dates and the difference value is output for my variable.
Regards
BalaHi:
Question 1:
We have same problem, and what we did is to create:
- 2 NON KPI:
R1 = Revenue current year
R2 = Revenue previous year
- 1 virtual KPI
R3 = R2-R1
Question 2:
I don't know.
Regards. -
Java code to get the difference between two dates in days
Hi ppl,
I need to write a user defined function to get the difference between two date nodes, in days.Please help me out
regards,
PrashanthHi,
have a look at those two:
(How do I calculate the difference between two dates?)
http://joda-time.sourceforge.net/faq.html
Calculating the Difference Between Two Datetime Stamps
http://www.xmission.com/~goodhill/dates/deltaDates.html
Get difference in days
http://javaalmanac.com/egs/java.util/CompDates.html
Regards,
michal -
Difference between Two Date Should come into Text Item
Dear All,
i want to get difference between two date into text Item :P36_C in On Change java script.
i have two Date Item :P36_A and :P36_B .i have extract these date value from table then difference comes into Text Field :P36_C.
Now i want if i change Date into Item :P36_A or Item :P36_B then Defference between two date Should Come into Item :P36_C .
So i have use Java Script Code to do this
<script>
function diffdat(){
function getVal(item){
if($x(item).value != "")
return parseFloat($x(item).value);
else
return 0;
$x('P36_C').value =
getval((TO_DATE('P36_B', 'DD-MON-YYYY'))-
getval(TO_DATE('P36_A', 'DD-MON-YYYY')))+1;
</script>
i have put this into Item HTML Form Element Attributes
onChange="javascript:diffdat();"it's not woring .
How to work that Code with dates.
ThanksYou can always create your own difference function based on your own criteria. You can modify this to suit your needs.
CREATE OR REPLACE FUNCTION CALC_OFFICE_DAYS(date1 DATE, date2 DATE)
RETURN NUMBER
IS
v_begin_date DATE := date1;
v_end_date DATE := date2;
v_office_start_time VARCHAR2(10) := '09:30 AM';
v_office_end_time VARCHAR2(10) := '06:30 PM';
v_comp_begin_time DATE;
v_comp_end_time DATE;
v_days PLS_INTEGER := 0;
v_hrs NUMBER := 0;
v_ttltm NUMBER;
BEGIN
select trunc(v_end_date) - trunc(v_begin_date)
into v_days
from dual;
select to_date(to_char(sysdate,'DD-MM-YYYY')||' '||to_char(v_begin_date,'HH24:MI'),'DD-MM-YYYY HH24:MI')
into v_comp_begin_time
from dual;
select to_date(to_char(sysdate,'DD-MM-YYYY')||' '||to_char(v_end_date,'HH24:MI'),'DD-MM-YYYY HH24:MI')
into v_comp_end_time
from dual;
select (v_comp_end_time - v_comp_begin_time)/24 into v_hrs from dual;
IF v_hrs > 4 then
v_ttltm := v_days + .5;
ELSE
v_ttltm := v_days;
END IF;
return v_ttltm;
END;
As has been noted, this question is best posted on the PL/SQL forum. -
Difference between two timestamp.
Hi,
I want to find difference between two timestamp in minutes.
Actually i want to retrieve difference between current timestamp and the timestamp taken from the table
select log_time from serv_info where server_id = 1;
Can anyone tell me the query to find difference between two timestamps in minutes.
-haifriendsSQL> WITH serv_in AS
(SELECT SYSTIMESTAMP - 1 / 4 log_time,
SYSTIMESTAMP now
FROM DUAL)
SELECT log_time,
now,
24 * 60 * EXTRACT (DAY FROM (now - log_time))
+ 60 * EXTRACT (HOUR FROM (now - log_time))
+ EXTRACT (MINUTE FROM (now - log_time))
+ 1 / 60 * EXTRACT (SECOND FROM (now - log_time)) diff_in_minutes
FROM serv_in
LOG_TIME NOW DIFF_IN_MINUTES
01-MRZ-07 01-MAR-07 03.47.42.107462 PM +01:00 360,001791 -
Difference in the display/rendering between two 7.4 portal systems
Hi everyone,
At this moment we are faced with a difference in the display/rendering between two 7.4 portal systems (see red area’s in screenshots). Both systems are green field installations.
At our LAB system with EP-BASIS 1000.7.40.7.0.20140421205300 and EP-RUNTIME 1000.7.40.7.0.20140414131600 the portal is rendered as follows:
Our development system DEV is based on EP-BASIS 1000.7.40.8.7.20141217073700 and EP-RUNTIME 1000.7.40.8.13.20150106224500. The portal is displayed as follows:
Both portal systems use the standard SAP Gold Reflection theme.
The expectation was that the DEV portal would have the same view as the LAB portal. Unfortunately, it appears that the DEV portal falls back to the older standard SAP Tradeshow theme when displaying (for example) the Portal Content Studio or the UWL. Different stylesheets (CSS) are loaded. There is no unified rendering and in our opinion this is not correct.
SCN provides much information about the various rendering problems that exists in the use of Internet Explorer in combination with the SAP Portal. However, it is unclear to us where to start with the analysis of this problem.
Answers / suggestions to the following questions will be highly appreciated:
Is it correct that the portal by default should make use of UR when the SAP Gold Reflection theme is used?
Is the difference of rendering caused by the difference in the versions of the EP BASIS / EP RUNTIME? (DEV portal has higher SP/patch level than LAB);
How to investigate this issue further and finally solve it?
Thanks in advance!
Kind regards, AllanHi Allan
I hope you are well and many thanks for using the SAP Discussion Forums .
Ok firstly in relation to this particular query, you can find additional information in the following documentation SAP Note:1852400 - UI theme designer (main note) .
Regarding the GOLD Reflection theme from a general perspective this is supported only alongside the UFP framework.
SAP Gold Reflection supports only Unified Rendering Lightspeed
In relation to your two other queries. Could you kindly clarify which particular version of IE you are presently running and also if compability mode is presently enabled/disabled?
Reference Documentation Look & Feel, Framework Pages and Portal Navigation
http://scn.sap.com/docs/DOC-23058
Kindly update me as per your findings.
Kind Regards
Troy Cronin - Enterprise Portal Support Engineer
Follow - Troy Cronin -
How to get the difference between two BufferedImages?
All the BufferedImage which is grabbed from AWT may be same each other,
i only want to get the different part of two continuous BufferedImages and send ti over internet.
I have compared two BufferedImages by RGB (int[]), but this process wastes 400~500ms,it's terrible,:)
who has any good idea about this?
thanks
Best Wishes
mauvespanthanks ! cary ,
I have a list contained some BufferedImages gotten from AWT component,and then these images
will be transfered to client and displayed in Internet explore ,actually there are only some difference
between two continuous BufferedImages,i don't want to transfer the WHOLE image to client,SO i
want to handler every image before sending to client , at last, the different part will only be sent to client.
All these ideas will be contained this method:
* Compare the specified two BufferedImages and return the different part between them.
* @param ref the specified first image
* @param gen the specified sencond image
* @return the different part between the specified two images.
public static void BufferedImage compareBufferedImage(BufferedImage ref,BufferedImage gen){
to finish this method ,do you have any good ideas?or sample code?
thanks
Best wishes
mauvespan -
Difference between two cells?
hi all, I am very new to using a mac, but am loving it so far no problems at all! I got 1 question I couldn't find an answer to tho, is there a way in numbers to have one cell display the difference between two other cells? I can do it by simple subtraction but if I change the values in the other cells some time the answer displays as a negative and others a positive. I would always like it to display as a positive.
example:
200 150 the difference between these two cells is 50
150 200 the difference between these two cells is 50
thanks for any help,
ChupagodYou want to display the absolute value of the difference. Your formula should be ABS(cell1-cell2).
-
Bestway to find difference between two roles in quality and production
We have a process of collecting su53 dump and then analyze for missing authorization . However some time although everything works fine in quality , it fails in production . Hence I want to know a simple methodology to compare roles in quality and production to know difference ... Can anyone share best methodolgy being used in your setup ?
NPB(1)How to find the difference between two dates at Universe level and at report Level in IDT?
DaysBetween ([Sale Date];[Invoice Date]) returns 2 if [Sale Date] is 15 December 2001 and [Invoice Date] is 17 December 2001.
(2) How to change format of dates from YYYY/MM/DD to DD/MM/YYYY in IDT at prompt level ?
=FormatDate(ToDate(YOUR DARE OBJECT);"YYYY/MM/DD");"dd'/'MM'/'yyyy")
=To_Char (object name, required format)
Find the below link for more info.
http://scn.sap.com/community/semantic-layer/blog/2014/04/18/bi41-business-layer-enhancements--create-display-format
(3)What is VIEWS in IDT of data foundation layer when we right click? could u plz give one example where exactly we use VIEWS?
A custom data foundation view is a subset of the data foundation Master view. You can use views when editing a large data foundation, and interested in working with a subset of tables. You can define multiple custom views for the data foundation due to the complexity of the data warehouse.
Essentially, need created views for each individual star scheme (like Sales, Production, Finance, Accounting, etc.) plus a view for eachcomplex dimension structure (like Business Partner, Material, Customer, Plant etc.),
Find the below link for more info.
http://scn.sap.com/docs/DOC-54422
(4) How to represent & report my IDT data in dashboards? could u plz explain the steps?
Please find the below link: http://scn.sap.com/docs/DOC-27559 -
How to find the structural difference between two tables
Hi all,
How to find the structural difference between two tables .
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
Thanks,
P Prakashyou could try something similar to this, for each table pair that you want to compare:
SELECT 'TABLE_A has these columns that are not in TABLE_B', DIFF.*
FROM (
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_A'
MINUS
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_B'
) DIFF
UNION
SELECT 'TABLE_B has these columns that are not in TABLE_A', DIFF.*
FROM (
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_B'
MINUS
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_A'
) DIFF;that's assuming, column_name, data_type and data_length are all you want to compare on. -
How to get the difference between two columns in a column group
Hi All,
My first time here and really new to programming. I would like to get the difference between 2 columns that are inside
a column group.
Here is my sample table below: The Column Group is PeriodNumber and can only choose 2. like 1 and 2.. I would like to have a third row which will simply calculate the difference between the amounts in PeriodNumber 1 and 2.
PeriodNumber
Account 1 2
1) Cash 10,000 15,000
2) Receivables 12,000 11,500
3) Equipment 5,000 5,500
Total Assets 27,000 32,000Hi yabgestopa,
From your description, you want to get the difference between two columns in a column group. After testing it in my environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
Dim Shared Num1 As Integer
Dim shared Num2 As Integer
Public Function GetAmount(Amount as Integer, Type as String)
If Type = "1" Then
Num1=Amount
Else
Num2=Amount
End If
Return Amount
End Function
Public Function GetDif()
Return Num1-Num2
End function
Right-click the second column to insert a third column with Outside Group-Right.
Then use the expressions below in the matrix.
=Code.GetAmount(Fields!Amount.Value,Fields!PeriodNumber.Value)
=code.GetAmount(Sum(Fields!Amount.Value),Fields!PeriodNumber.Value)
=Code.GetDif()
The report looks like below.
If you have any questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Date difference between two dates
hi All,
i have to right a stored proc to find the difference between two dates.
for example of i give
startdate as 4/1/2015 and enddate 14/1/2015
i should get 1 year , 10 days and 0 months .
i have tried the DateDiff function but it does not calculate the leap year.
please help.DECLARE @from datetime
DECLARE @to datetime
SET @from = '20150104 8:00'
SET @to = '20150114 10:30'
SELECT DATEDIFF(minute,@from, @to) % 60 as Minutes
SELECT (DATEDIFF(minute,@from, @to) / 60) % 24 as Hours
SELECT DATEDIFF(minute,@from, @to) / (60 * 24) as Days
SELECT DATEDIFF(month,@from, @to) as Months
SELECT DATEDIFF(year,@from, @to) as Year
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Find the difference between two internal table
how can i see the difference between two interal tables?
The requirement is as follows
1. We have a transparent table, which stores the employee data with EMP ID as key.
2. We load the transp table data into a interal table (B).
3. We get data from legecy system as file and it gets loaded into another internal table (A) (this also has the same EMP ID key and this will have latest addition/update to those emplyees).
Now we need to seperate out these data into three interal table Inserted (I), Deleted (D) and Updated (U).
We want to do followign things
I = A - B
D = B - A
Both A and B will have around 40k records. Hence we are trying to avoid the looping.
Please suggest the best option for us.
Thank you in advance.
Raghavendra>
RAGHAV URAL wrote:
> how can i see the difference between two interal tables?
> The requirement is as follows
>
> 1. We have a transparent table, which stores the employee data with EMP ID as key.
> 2. We load the transp table data into a interal table (B).
> 3. We get data from legecy system as file and it gets loaded into another internal table (A) (this also has the same EMP ID key and this will have latest addition/update to those emplyees).
>
> Now we need to seperate out these data into three interal table Inserted (I), Deleted (D) and Updated (U).
>
> We want to do followign things
> I = A - B
> D = B - A
>
> Both A and B will have around 40k records. Hence we are trying to avoid the looping.
>
> Please suggest the best option for us.
>
> Thank you in advance.
> Raghavendra
Hi Raghavendra,
Currently as of my knowledge, these operations are only possible through LOOPs. But LOOPign can be really fast here if you properly utilize the SORTING, READ with BINARY SEARCH and FIELD-SYMBOLS usage. I would say:-
Steps for Insert:-
SORT: A, B.
LOOP AT A ASSIGNING <WA_A>.
READ TABLE B WITH TABLE KEY key = <WA_A>-key BINARY SEARCH.
IF SY-SUBRC NE 0.
APPEND <WA_A> TO I.
ENDIF.
ENDLOOP.
Steps for Delete:-
SORT: A, B.
LOOP AT B ASSIGNING <WA_B>.
READ TABLE A WITH TABLE KEY key = <WA_B>-key BINARY SEARCH.
IF SY-SUBRC NE 0.
APPEND <WA_B> TO D.
ENDIF.
ENDLOOP.
Regards,
Ravi. -
Find the difference between two columns in an ssrs matrix ? MSCRM
Hi All,
I am working in reporting part of our project (On-line MSCRM 2013) & in reporting services.
I am trying to create report using fetch xml based. Below is the snap what we required the result.
Kindly help me, how to get the difference in both column. (Its a matrix table where year is grouped).
We need difference between both year Like (Plan Revenue of 2013 & Plan Revenue of 2014 difference in Plan Revenue Diff section) and same for Actual
Revenue.
https://social.microsoft.com/Forums/en-US/054d5ca4-0d38-4dc6-84a8-88866cc228fe/find-the-difference-between-two-columns-in-an-ssrs-matrix-mscrm?forum=crmdevelopment
Thanks,
Mohammad ShariqueHi Bro,
I used parametrized option for year and done the report,Currently we are getting values in Difference column now i want to show
that value in percentage. How can we show the percentage based on that value. Means i want to show the Difference in Percentage.
Kindly help me i tried but getting some issue. Below i am mentioning the code and snap with result.
Below expression using to showing Plan Revenue in Percentage for year.
=
Sum(IIF(Fields!new_year.Value =Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))
- Sum(IIF(Fields!new_year.Value =Parameters!EndYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))
/IIF(Sum(IIF(Fields!new_year.Value = Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))>0,
(Sum(IIF(Fields!new_year.Value = Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0))))
,1)
)*100))
Result issue is as below in snap with highlighted in red colour.
Kindly help me on this issue also :) -
X6 = "1/5/15 5:16 AM" & NOW ....................difference by Only Time
not date
X6 date and Time will be changing, Its not Constant
Dim myDateTime As DateTime = X6
Dim myDate As String = myDateTime.ToString("dd/MM/yy")
Dim myTime As String = myDateTime.ToString("hh:mm tt")
Dim myDateTime1 As DateTime = Now
Dim myDate1 As String = myDateTime1.ToString("dd/MM/yy")
Dim myTime1 As String = myDateTime1.ToString("hh:mm tt")
Need to use this function to find the Difference between Two Time. due to 12:00 AM isuue
Function XLMod(a, b)
' This replicates the Excel MOD function
XLMod = a - b * Int(a / b)
End Function
Output Required
dim dd = XLMod(myTime - myTime1)
Problem is myTime & myTime1 is String Need to convert them into Time, Later use XLMOD Funtion.Induhar,
As an addendum to this, I thought I'd add this in also: If you have two valid DateTime objects you might consider using a class which I put together a few years ago
shown on a page of my website here.
To use it, just instantiate with two DateTime objects (order doesn't matter, it'll figure it out) and you'll then have access to the public properties. For this example, I'm just showing the .ToString method:
Option Strict On
Option Explicit On
Option Infer Off
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim date1 As DateTime = Now
Dim date2 As DateTime = #1/1/1970 2:35:00 PM#
Dim howOld As New Age(date1, date2)
MessageBox.Show(howOld.ToString, "Age")
Stop
End Sub
End Class
I hope that helps, if not now then maybe at some point in the future. :)
Still lost in code, just at a little higher level.
Thanx frank, can use this in Future....
Maybe you are looking for
-
In Windows 8.1 Premiere Pro video imported clips shows up black screen in Source & Work space. Everything is updated on my PC. They say it could have been a Windows update? Is anyone else having this problem and found a solution any suggestions.. Tha
-
Adobe Media Encoder CS4 problem
I having a ***** at Adobe I do have a lienced copoy CS4 Design Premium. I down loaded premier pro CS4 to demo it about 8 months ago and had not used it up to about 1 weeks ago. All that time Adobe Media Encoder CS4 did not work. I came back to the
-
Problem loading a custom class in workflow
Hi. my configuration is DB 8.1.7 workflow 2.6.0 I want to execute an external java, and to do that i wrote a simple class (based on API specification) I receive that error when I run Loadjava on a that very simple class. JAVA CLASS OWF_MGR.pippo On l
-
IPhone 3GS from Apple store in Germany? Is it unlocked?
Hey everyone! I have a UK 02 contract with an unlocked iPhone 3GS (unlocked by 02 after my initial 18 months). I was having problems with the phone and Apple in Germany replaced it a couple of weeks ago under warranty (as it's a worldwide warranty an
-
Hi, I need to apply this note. The highest support package for this note in 46C is SAPKH46C50 and in the system tht i am working it is SAPKH46C45 so will it create any problem while implementing the note? if den how do i overcome tht?