24 Hour date format - How to capture


#1

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


#2

Hi @Ula,

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


#3

Thank you @arivu96


#4

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?


#5

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


#6

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


#7

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


#8

Thanks @Niket_Ghai.
Great Work.