Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi There,
I have two dates as follow;
1. num(Date(monthend(today(),-1), 'DD/MM/YYYY hh:mm:ss[.fff]')) which gives me 44012.999999988
2. num(Date('30/06/2020 23:59:59', 'DD/MM/YYYY hh:mm:ss[.fff]')) which gives me 44012.999988426
Basically both code returns the same date ie '31/06/2020 23:59:59' but the number representative is not the same. How could one construct the date so that it will return the same num values?
Many thanks in advance.
Hi
Note that functions like monthend, yearend etc return the last miliseconde of the imput value
So if you want exactely the same value use dayend() function like this :
num(dayend(Date('30/06/2020 23:59:59', 'DD/MM/YYYY hh:mm:ss[.fff]')))
this will give you the same result as
num(Date(monthend(today(),-1), 'DD/MM/YYYY hh:mm:ss[.fff]'))
hop it helps
you can use Floor(Date(monthend(today(),-1), 'DD/MM/YYYY hh:mm:ss[.fff]')) and Floor(Date('30/06/2020 23:59:59', 'DD/MM/YYYY hh:mm:ss[.fff]')) to compare the date
Hi
Note that functions like monthend, yearend etc return the last miliseconde of the imput value
So if you want exactely the same value use dayend() function like this :
num(dayend(Date('30/06/2020 23:59:59', 'DD/MM/YYYY hh:mm:ss[.fff]')))
this will give you the same result as
num(Date(monthend(today(),-1), 'DD/MM/YYYY hh:mm:ss[.fff]'))
hop it helps
Hi Sir,
I purposely do not want to use FLOOR because i want to preserve the timestamp info from the dates.
Thank you
Hi Sir,
Thank you for the explanation. It helps me figure out what exactly went wrong with my dates formatting. In my requirements, i need to remove the milisecond from the date. I came out with the below and now I'm getting the same num value for both dates. Many thanks again sir!.
Timestamp#(Timestamp(monthend(today(),-1),'DD/MM/YYYY hh:mm:ss'),'DD/MM/YYYY hh:mm:ss')