24 Hour date format - How to capture

Hello

I want to print date in 24 hour format. Please suggest. Currently taking a screenshot and saving them in dd_MMM_yyyy_hh_mm_ss format and the system time is 18:24. The output captures time only as 06_24 (hh_mm) how to make it as 18_24. Please suggest

1 Like

Hi @Boopathi,

HH:mm:ss
HH --> 24 hour format

Custom date format
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

Regards,
Arivu

4 Likes

Thank you @arivu96

Hi @arivu96
I am using message box to diaplay todays date but it is giving wrong output.
Input: DateTime.Now.ToString(“mm-dd-yyy”)
output: 48-22-2018

I tried with different options but every time it gives wrong value for month.
How to solve this issue?

now.ToString(“MM-dd-yyyy”)
Use this! :slight_smile:

Thanks @Niket_Ghai.
It is working fine. Can we print print tomorrows date with this method?

1 Like

now.AddDays(1).ToString(“MM-dd-yyyy”)
There you go!

Thanks @Niket_Ghai.
Great Work.

1 Like