March 30, 2018 at 11:37 am
I'm calculating the last day of the previous month in the "Report End Date" parameter of my report.
Following is the formula I'm using, which is working perfectly fine. The only problem is that this formula is giving me the time along with the date. How can I hide the time.
=dateadd("s"
,-1,dateadd("q",datediff("q","1/1/1900",today()),"1/1/1900"))I tried using FormatDateTime function, but I'm getting an error.
=FormatDateTime(dateadd("s",-1,dateadd("q",datediff("q","1/1/1900",today)),"1/1/1900")),DateFormat.ShortDate)
Please let me know as to what I'm doing wrong here and how can I hide the time.
Thanks!
March 30, 2018 at 11:44 am
I resolved the issue by using the following format
=CDate(FormatDateTime(Now(),DateFormat.ShortDate))
March 30, 2018 at 1:19 pm
In the properties for the cell, under 'Number' there is Format, if you put a lower case d it will display the date without the time in MM/DD/YYYY format.
-------------------------------------------------------------
we travel not to escape life but for life not to escape us
Don't fear failure, fear regret.
April 1, 2018 at 10:41 am
=Today.AddDays(0 - Today.Day)
=DateSerial(Year(Today), Month(Today), 1).AddDays(-1)
Alternative methods:
=Today.AddDays(1 - Today.Day).AddMonths(-1) \\First of last month
=Today.AddDays(0 - Today.Day).AddMonths(0) \\Last day of last month
=Today.AddDays(1 - Today.Day).AddMonths(-2) \\First of prior month
=Today.AddDays(0 - Today.Day).AddMonths(-1) \\Last day of prior month
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply