remove hours and minutes from currentdate
source link: https://community.sap.com/t5/technology-q-a/remove-hours-and-minutes-from-currentdate/qaq-p/13588264
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Hello,
I wish to remove hours, minutes and seconds from the value returned by 'currentdate'.
I do not mean format the date to hide the hours minutes and seconds using formatedate()
I wish to take the currentdate() valuesand change it so that the HH mm ss = 00 00 00
I was thinking I could take currenttime() convert that to 'X' seconds, then use relativedate to subtract the X seconds from currentdate.
Not sure how to implement this. Using Business Objects BI 4.3
- SAP Managed Tags:
- SAP BusinessObjects Business Intelligence platform
Accepted Solutions (0)
Answers (2)
4m ago
There are two solutions for this:
First Solution:
As you mentioned, convert the current time to seconds and subtract the time from the current date using relative date
v_CurrTimeInSec:
= ToNumber(Substr(FormatDate(CurrentDate();"HH:mm:ss"); 1 ; 2 )) * 60 * 60 + ToNumber(Substr(FormatDate(CurrentDate(); "HH:mm:ss"); 4 ; 2 )) * 60 + ToNumber(Substr(FormatDate(CurrentDate(); "HH:mm:ss"); 7 ; 2 ))
v_BeginOfDay_1
=RelativeDate(CurrentDate();-[v_CurrTimeInSec];SecondPeriod)
Second Solution: (the easiest)
v_BeginOfDay_2
=ToDate(FormatDate(CurrentDate(); "dd-MM-yyyy") + " 00:00:00"; "dd-MM-yyyy HH:mm:ss")
I hope it helps
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK