How I can get the current date in 19/12/2022 04:23:54 date and time formate

image
I am doing like this how can i get time in hh:mm:ss

Hi @Sandhya_Gajare

DateTime now = DateTime.Now;
string dateTimeString = now.ToString("dd/MM/yyyy HH:mm:ss");

Hi @Sandhya_Gajare

Checkout this

12hrs format

Now.ToString("dd/MM/yyyy hh:mm:ss")

24 hrs format

Now.ToString("dd/MM/yyyy HH:mm:ss")

If you want Am/PM

Now.ToString("dd/MM/yyyy hh:mm:ss tt")

Regards
Sudharsan

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