and getting below results, you can see results are changing every time for month.
17-13-2019 08:13:59
17-14-2019 08:14:22
But if I use System.DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss")
I am getting the correct result, see below:
17-09-2019 08:14:45
I am not able to understand why it is happening, if I just use the month in uppercase why it is working fine and why not with small case. If I put only month in uppercase code is not looking so good in formatting way, also if I put all in upper case System.DateTime.Now.ToString("DD-MM-YYYY HH:MM:SS")
then I am getting below result:
DD-09-YYYY 20:09:SS
Unable to understand the behavior of this. Can anyone please explain this.
hi
welcome to UiPath community
usually when mm means minutes and MM means Month
So in the first expression we were getting the minutes in place of month
17-13-2019 08:13:59
17-14-2019 08:14:22
and after changing the value to MM
we get the right value
17-09-2019 08:14:45 (see the difference)
so the usual format be like this
dd-MM-yyyy hh:mm:ss
where
dd - date
MM - month in number
MMM - month like Jan, Feb
MMMM - month like January, February
yyyy - 2019
yy-19
and in timestamp part
hh - hours in 12 hr format
HH - hours in 24 hr format
mm - minutes
ss - seconds
tt - AM or PM (if needed at last like this dd-MM-yyyy hh:mm:ss tt)
@Palaniyappan Many Thanks. Can you please also confirm why we are not getting for seconds when we use SS, also for date and year with DD and YYYY. Is this only work with small caps?