cancel
Showing results for 
Search instead for 
Did you mean: 

remove hours and minutes from currentdate

Chugging_Along
Discoverer
0 Kudos
308

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

Accepted Solutions (0)

Answers (2)

Answers (2)

ayman_salem
Active Contributor
0 Kudos

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)

B_20240213_0.JPG



Second Solution
:   (the easiest)

v_BeginOfDay_2
=ToDate(FormatDate(CurrentDate(); "dd-MM-yyyy") + " 00:00:00"; "dd-MM-yyyy HH:mm:ss")

B_20240213_1.JPG

...

I hope it helps

 

 

 

amitrathi239
Active Contributor
0 Kudos