DateTime format last day of previous month in "mm/dd/yyyy"

Hello, I need to type into a date field in “mm/dd/yyyy” format. I use:

assign
GLdate = New datetime(now.Date.Year, now.Date.Month,1).AddDays(-1) where GLdate is a DateTime type.
this gave correct result of 10/31/2021 00:00:00

I use another assign
GLdateStr = GLdate.tostring(“mm/dd/yyyy”) but this gave 00/31/2021, please how to fix this?

thanks!

Hi,

Can you try as the following?

GLdateStr = GLdate.tostring("MM/dd/yyyy")

FYI

“mm” means minute, from 00 through 59.

Regards,

@Yoichi Thank you so much for your quick response!!! works fine now!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.