Date formats-time difference
Hi,
Any function module which can give the date and time difference if i input the date and time in the following format
20090322 (date)
20090321 (date)
040004 (time)
040000 (time)
I had checked the other FM's but those are not in synch with the date format I am giving.Do anyone here know about a FM which can give the time difference even if we input the date and time in the above format.
Format is the problem I am facing.
Thanks,
Hi Folks,
I just want to avoid all the below computations and expecting to get the result irrespective of whichever the date format is,ie a function module which gives me the time difference irrespective of the date format that is fed as input.Seems it is not possible.
data:date1(08) type C value '20090322',
date2(08) type c value '20090322',
time1(08) type c value '060648',
time2(08) type c value '062403',
date3(08) type C,
date4(08) type c,
time3(08) type c,
time4(08) type c,
temp1(08) type C,
temp2(08) type c,
temp3(08) type c,
temp4(08) type c,
temp5(08) type C,
temp6(08) type c,
temp7(08) type c,
temp8(08) type c,
temp9(08) type c,
temp10(08) type c,
temp11(08) type c,
temp12(08) type c,
gpdt type d,
gptm type t,
smsdt type d,
smstm type t,
e_tdiff type cva_time,
v_diff type cva_time,
e_days type i.
temp1 = date1+0(4). "year
temp2 = date1+4(2)."month
temp3 = date1+6(2). "date
temp4 = time1+0(2)."hrs
temp5 = time1+2(2)."mins
temp6 = time1+4(2)."secs
temp7 = date2+0(4). "year
temp8 = date2+4(2)."month
temp9 = date2+6(2). "date
temp10 = time2+0(2)."hrs
temp11 = time2+2(2)."mins
temp12 = time2+4(2)."secs
concatenate: temp3 temp2 temp1 into gpdt,
temp9 temp8 temp7 into smsdt,
temp4 temp5 temp6 into gptm,
temp10 temp11 temp12 into smstm.
CALL FUNCTION 'SCOV_TIME_DIFF'
EXPORTING
im_date1 = gpdt
im_date2 = smsdt
im_time1 = gptm
im_time2 = smstm
IMPORTING
EX_DAYS = e_days
EX_TIME = e_tdiff
* EXCEPTIONS
* START_LARGER_THAN_END = 1
* OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write:/ e_tdiff,
e_days.
Thanks,
Similar Messages
-
SAP BI Date and Time Difference calculations in DSO Transformation
Hello Guys,
Could you please tell me how to calculate the date and Time difference between 2 fields.
I have 2 date fields :
Arrival Date : 6/16/2007
Departure date : 6/19/2007
Also i have 2 time fields for the above
Arrival Time : 13:00:00
Departure Time : 11:50:00
I want to display all the four fields and 2 fields for the difference in Date and Time.
Is it better to calcuate the differences in DSO Transformation or can you do it in the report itself.Could you please let me know the solution.
Thanks,
BI ConsultantHello Consulant BI,
Computing the difference of two dates is easy (assuming you really just want the number of days). You can simply subtract the two dates using ABAP:
data: w_arrival_date type sy-datum,
w_dep_date type sy-datum,
w_diff type i.
w_arrival_date = <your arrival date field here>.
w_arrival_date = <your departure field here>.
w_diff = w_arrival_date - w_dep_date.
Getting the time difference isn't really much logical. I think what you want instead is to compute the totals days (and extra hours) right? If this is the case, then you can convert the date+time for both the arrival and departure into a timestamp variable first and then t the get difference.
Hope this helps. -
How to find the date and time difference in InfoPath 2013?
Hi All,
My date and time format is like: 2013-12-24T10:47:38 and have three fields Start date, End date and Actual time taken.
If start date and end date filled then actual time taken field should automatically should fill, for example 2 days 12 hours 48 min 3 sec.
How to achieve this?Hi Sam,
I believe we had discussed the same issue in the below thread. Can you please refer the below one?
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/d93e16ff-c123-4b36-b60b-60ccd34f6ca7/calculate-time-differences-in-infopath?forum=sharepointcustomizationprevious
If it's not helping you please let us know
Sekar - Our life is short, so help others to grow
Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
you see a reply being an answer to the question of the thread, click "Mark As Answer -
How to get exact date and time difference?
Hi,
When i am using the below sql statement:
SELECT (TO_DATE('7/27/2006 05:00:15 PM','MM/DD/YYYY HH:MI:SS PM') - to_Date('7/27/2006 8:30:13 AM','MM/DD/YYYY HH:MI:SS AM')) * 24 hours FROM DUAL;
the output is:
Hours
8.50055555555556
But Actually it is 8.30
So how can i get exact days and time difference between two dates in Oracle?
Thanks....
Regards,
Suman Sakinala
Edited by: SSN on Sep 19, 2008 1:27 AMOr more clearly (this time I have my date_from and date_to the right way around hehe!)
SQL> ed
Wrote file afiedt.buf
1 WITH t as (select TO_DATE('7/27/2006 05:00:15 PM','MM/DD/YYYY HH:MI:SS PM') as dt_to,
2 TO_DATE('7/27/2006 08:30:13 AM','MM/DD/YYYY HH:MI:SS AM') as dt_from FROM DUAL)
3 ,d as (select (dt_to-dt_from)*24 as diff_hrs from t)
4 -- end of dates
5 SELECT TRUNC(diff_hrs) as hours
6 ,TRUNC(((diff_hrs) - TRUNC(diff_hrs))*60) as mins
7 ,TRUNC(((((diff_hrs) - TRUNC(diff_hrs))*60) - TRUNC(((diff_hrs) - TRUNC(diff_hrs))*60))*60) as secs
8* FROM d
SQL> /
HOURS MINS SECS
8 30 2
SQL> -
Date and time difference for weekdays - urgent
Hi,
Is there any fun.module which will caluculate the difference between two dates and time excluding weekends?
Thanks in advance.
Srini.Hi,
Refer to the following link:
http://sap-img.com/abap/function-to-return-next-business-day.htm
Hope this helps.
Reward if helpful.
regards,
Sipra -
Date and time diffrence calculations
Dear Experts,
I have a doubt regarding the date and time diffrence calculation please help me out.
This is regarding the report called u201CVehicle tracking systemu201D. The purpose of this report is to give the user information like how many vehicles have come in and how much time each vehicle has parked in the filling in the refinery and also the average time taken for a customer.
For this we have created 4 info objects called
1) Park In Time
2) Park In Date
3) Gate Out Time
4) Gate Out Date
We have created a routine which calculate the difference in Vehicle Park In Date & Time to Gate Out Time and Date
The Time difference is number format.
Example: For Vehicle1
Park in Date and Park in Time are 27.11.2008 and 17:43:35
Gate out Date and Gate out Time are 29.11.2008 and 09:36:16
Here routine will calculate the difference in the above date and time and the output is like this 1,155.138,000 (i.e. 1day, 15 hours 51 mins and 38 seconds) that means the vehicle has parked for 1 day and 15 hours etc.
But we require the output like 1 day, 15:51:38
Please give us the solution how to go about it.
Thanks in advance,
venkatHi,
I think in regard to your problem, the solution will be to make the variables in the query runtime by the replacement path variable.
Please find the below link, its very much self explanatory and in regard to your problem.
Hope it helps!
[http://sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html]
Regards,
Neha. -
I hate to reinvent the wheel - Date/time differences
Does anyone have a concise SQL algorithm to find the difference between
2 dates and times where the dates are stored in a date field and the times are stored as a varchar in the format HH:MM:SS (24 hr clock).Hi,
I am using a stored procedure which give calculates the no of days between two dates. Try using/modifying it and see if it is of any help
The Procedure................
DECLARE
vdDateFrom DATE;
vnDayFrom NUMBER := 0;
vnMonthFrom NUMBER := 0;
vnYearFrom NUMBER := 0;
vdDateTo DATE;
vnDayTo NUMBER := 0;
vnMonthTo NUMBER := 0;
vnYearTo NUMBER := 0;
vnYearsDiff NUMBER := 0;
vnMonthsDiff NUMBER := 0;
vnDaysDiff NUMBER := 0;
E_STOP EXCEPTION;
BEGIN
vdDateFrom := '01/11/2001';
dbms_output.put_line('Date From: '||vdDateFrom);
vdDateTo := '17/11/2001';
dbms_output.put_line('Date To: '||vdDateTo);
IF vdDateTo < vdDateFrom THEN
RAISE E_STOP;
END IF;
vnDayFrom := to_char(vdDateFrom, 'dd');
vnMonthFrom := to_char(vdDateFrom, 'mm');
vnYearFrom := to_char(vdDateFrom, 'yyyy');
vnDayTo := to_char(vdDateTo, 'dd');
vnMonthTo := to_char(vdDateTo, 'mm');
vnYearTo := to_char(vdDateTo, 'yyyy');
IF vnMonthTo - vnMonthFrom < 0 THEN
vnYearsDiff := vnYearTo - vnYearFrom - 1;
ELSIF vnMonthTo - vnMonthFrom > 0 THEN
vnYearsDiff := vnYearTo - vnYearFrom;
ELSE
IF vnDayTo - vnDayFrom >= 0 THEN
vnYearsDiff := vnYearTo - vnYearFrom;
ELSIF
vnDayTo - vnDayFrom < 0 THEN
vnYearsDiff := vnYearTo - vnYearFrom - 1;
END IF;
END IF;
dbms_output.put_line('Years: '||vnYearsDiff);
IF vnMonthTo - vnMonthFrom < 0 THEN
IF vnDayTo - vnDayFrom >= 0 THEN
vnMonthsDiff := 12 + vnMonthTo - vnMonthFrom;
ELSIF
vnDayTo - vnDayFrom < 0 THEN
vnMonthsDiff := 12 + vnMonthTo - vnMonthFrom - 1;
END IF;
ELSIF vnMonthTo - vnMonthFrom = 0 THEN
IF vnDayTo - vnDayFrom >= 0 THEN
vnMonthsDiff := 0;
ELSIF
vnDayTo - vnDayFrom < 0 THEN
vnMonthsDiff := 11;
END IF;
ELSE
IF vnDayTo - vnDayFrom >= 0 THEN
vnMonthsDiff := vnMonthTo - vnMonthFrom;
ELSIF
vnDayTo - vnDayFrom < 0 THEN
vnMonthsDiff := vnMonthTo - vnMonthFrom - 1;
END IF;
END IF;
dbms_output.put_line('Months: '||vnMonthsDiff);
IF vnMonthFrom = vnMonthTo THEN
vnDaysDiff := vnDayTo - vnDayFrom;
IF vnDaysDiff < 0 THEN
vnDaysDiff := to_char(last_day(add_months(vdDateTo,-1)),'dd') - vnDayFrom;
IF vnDaysDiff < 0 THEN
vnDaysDiff := vnDayTo;
ELSIF vnDaysDiff >= 0 THEN
vnDaysDiff := vnDaysDiff + vnDayTo;
END IF;
END IF;
ELSE
vnDaysDiff := vnDayTo - vnDayFrom;
IF vnDaysDiff < 0 THEN
vnDaysDiff := to_char(last_day(add_months(vdDateTo,-1)),'dd') - vnDayFrom;
IF vnDaysDiff < 0 THEN
vnDaysDiff := vnDayTo;
ELSIF vnDaysDiff >= 0 THEN
vnDaysDiff := vnDaysDiff + vnDayTo;
END IF;
END IF;
END IF;
dbms_output.put_line('Days: '||vnDaysDiff);
EXCEPTION
WHEN E_STOP THEN
dbms_output.put_line('Error: Date To is less than Date From.');
END;
Regards
Dinesh -
How to calculate the Time difference between 2 dates
HI All,
I am using HR_hk_diff_btw_2_dates to calculate the employee service dates.
For that i am inputing his hire date and Term dates and Output format as '05' i am getting output perfectly....
But problem is whe i am inputting the employee hire date is Dec 1 2007 and Term date is
March 31 2009 It is coming as 1 year 3 months 31 days instead of 1 year 4 months directly .......How could we make it make last date also working day and get the O/p as 1 year 4 months ?Please Advice..
Regard
sas1. FM for difference betwwen two times:SCOV_TIME_DIFF
Import parameters Value
IM_DATE1 2008-01-01
IM_DATE2 2008-01-01
IM_TIME1 10:00:00
IM_TIME2 11:30:00
Export parameters Value
EX_DAYS 0
EX_TIME 01:30:00
2. SD_CALC_DURATION_FROM_DATETIME : Finds the difference between two date/time and report the difference in hours
L_MC_TIME_DIFFERENCE : Finds the time difference between two date/time -
How do I set a custom time & date format in the top bar?
Hello guys,
Very embarassing question, because I've had Apple's for all of my life (starting with the original Apple Macintosh) but I still haven't figured out one thing
How do I set a custom time & date format in the top bar?
When I go to System Preferences > Language & Text > Formats I can set different formats. I have no idea where you will see these, but I know that it's not the top bar where the time and date is being displayed. Because no matter what I enter, the format in the top bar will stay the same. I can only choose things like 24-Hour clock or not, blinking dots and so on in the Time & Date settings from the System Preferences.
Can anyone here point me in the right direction? I see you can even choose to display the week of the year - I'd love to do that!
All help appreciated!
GreetingsLanguage & Text system preferences, Formats tab, customize dates.
There are also many third party menu item utilities that can. Search Macupdate.com for some.
One search yielded iClock Pro. Although I never used it I would think it allows customization. The link I gave you is to the Macupdate download page for that app. On that same page is a Similar Software section which has other apps that can do the same thing.
One listed is iStat Menus. The primary use for iStat Menus is not for displaying date/time but it does do that. And I know it can do what you want because I use iStat Menus to track temperature sensors n my machine and, like you, I want to customize the menu time/date. So I use it instead of the apple clock. It does have the customization features I think you are looking for. -
How do i format date and time in SSRS 2008
Okay, so i am working with SSRS 2008. I am formatting the date and time. Right now the current out put is 1/13/2014 8:02:11 AM. I want the output to
be 1/13/14 8:02 AM. What is the expression for this?
Thanks in advanceThere are 2 functions that can be used, Format and FormatDateTime.
http://www.jackdonnell.com/?p=122
"You will find a fortune, though it will not be the one you seek." -
Blind Seer, O Brother Where Art Thou
Please Mark posts as answers or helpful so that others may find the fortune they seek. -
Formatting Date and Time in Smartforms.
Hello,
I'm a newbie and I'm working with smartforms.
My requirement is to get the following format of date and time in a text within a template.
'MMM DD HH:MM'
Like : Jan 01 12:45
I have tried SAPScript Commands like 'SET DATE MASK' but that doesn't appear to work.
Do I have to use a Function Module?
Please help out. A sample code will be appreciated!
Regards & Thanks,
Arun G NairHi,
please see this code
DATA: V_DATE1 TYPE STRING
SELECT SINGLE LTX FROM T247
INTO MONTH_NAME
WHERE SPRAS = SY-LANGU
AND MNR = SY-DATUM+4(2).
CONCATENATE MONTH_NAME SY-DATUM+6(2) DATE1(4)
INTO V_DATE1 SEPARATED BY SPACE. -
Ack file date and time format is same as in source xml format
Hi...All,
1) my scenario is file-rfc-file using BPM,
we are getting file in xml format from source along with timestamp and this data will be going to R/3 and the acknowledgement (success or failure) file will be sending back to source system.
in this sceneario we have to fulfill in the follwing client requirement
File1.<same File1 date and time>.XML
Is it possible to make it as the following? if it is possible
could u please let me know how to fulfill the follwing requirement.
ACK File1.<same File1 date and time>.XML
Where <same File1 date and time> format = u2018YYYYMMDDhhmmssu2019 .
2) Is the XML file name visible in the SAP-XI monitoring screen and will it help to trace the messages?
thanks in advance,
Pasi.Hi,
I didnot under stand your first question coulf you be more specfic.
2. Ans : In general , we will follow the below steps
--First we we check for the file is picked or no, if not see the Sender side CC parameters like mode and path details
--If file was picked then we need to check whether we are using the File content conversion parameters or not if yes we need to check the FCC parameters ,
Goto RWB-Channelmonitoring by the following link
http://host:port/mdt/channelmonitorservlet
select the sender side CC name and check for errors
If no errors in above, goto SXMB_MONI for Integration Engine xml processing , check for successful or error occured black or red color
--if success in SXMB_MONI then we need to check in RWB as above channel monitor now select the receiver side CC
If no errors then check for output file is placed intarget or not
Please reward points if it helps
Thanks
Vikranth -
Menu bar date and time format in Lion
Is there a way to change the formatting of the date and time shown in the menu bar in Lion? I've been googling for a while, but can't find a solution. At the moment the time has a very unusual format of <hh:mm.ss>. Note the '.' before seconds. What I want to achieve is to change that dot to a colon as it normally is (and was in Leopard and earlier, don't know about Snow Leopard), ie. <hh:mm:ss>. I've checked the date and time formats in system settings several times, but those have no effect on the menu bar. When I set the clock to display an analogue icon and click on it, the date and time in the popup menu are shown correctly using the full format.
johankytt wrote:
Well ofcourse I am. And no, I am not using a third party utility. This functionality has been available in OSX for ages.
I never noticed that option!
It works ok for me (with a colon, not a dot).
Is it possible you have a dead pixel where the top dot of the colon should be? -
I can't seem to find a way to update the date/time of a master file. There is a format issue but I can't seem to figure out how to correct it.
Aperture was not able to adjust the date and time of the master file “2008-06-22 at 14-41-14.jpg” because it has a format that does not permit date modification.Can you post an ipconfig /all from the server and the DC?
Robert Pearman SBS MVP
itauthority.co.uk |
Title(Required)
Facebook |
Twitter |
Linked in |
Google+ -
I need to get the Current System Date and time in the format
I need to get the Current System Date and time in the format
*6/24/2009 11:30:29 AM*
How do i do it ?I seem to be saying this a lot lately.
Google is your friend.
I googled "java current date format" and SimpleDateFormat featured prominently in the results.
Maybe you are looking for
-
How do I get a new email for Apple ID? Forgot password to old email linked to ID :(
I created my first iTunes account when I was in middle school (very long ago). I of course used my email from those days to create my ID. I continued to use my iTunes even when I got a new email, so I remembered my Apple ID password, but have since f
-
Create Spool from Internal table & converrt the spool to PDF
Hi All, My requirement is take data from a table and find amount specific to each Vendors . So I took all the data into ITAB and do all the calculation. Later after calculation I have to create a spool from this ITAB and this spool have to convert to
-
Iphone ios 8 hangs after or before call.
I have been facing this problem since like 2 months and I bought this phone like 3 months before and this problem increased accuring after updating to IOS 8. Anybody please help!!
-
Trying to connect iPad Air latest version to a Mac Mini running Yosemite .Connection is made by Bluetooth (hoping to access the Drafts folder of the iPad to lift off attachments to Mac mini) BUT the connection drops out after 20" or so.
-
Batch Command in CS5 is greyed out
The Batch Command in CS5 is greyed out. I am running CS5 64 bit with Windows 7 64-bit. Any ideas. It was working and now it does not.