Time and Date get rid of AM/PM

I want exact digital time: like 14:00

what is the right format?

Hi @Nightowl_music,

you can use DateTime.Now.ToString(“HH:mm”)

Thanks

it still shows 02:00

Please try again with this

DateTime.Now.ToString(“HH:mm”)

this is my format

DateTime.Now.ToString("dd-MM-yyyy HH:mm”)

Hi @Nightowl_music ,

your using correct format it will provide the current date and time. from my side it is showing the below date and time. what is your exact question.

04-02-2022 17:16

it’s 14:00 her but im still getting 02:00 with this expression

Hi!

Try this:

Only Time:

DateTime.Now.ToString(“hh:mm tt”)

Date with Time:

DateTime.Now.ToString(“MM/dd/yyyy hh:mm tt”)

Regards,
NaNi

doesn’t work still get 02:00

Hi!

Have a view on this:

Regards,
NaNi

you are using correct logic. these expression will bring the date and time format from system i guess. could you pls check your system what is the time format you are having. change the system time and see if you are getting the correct output. thanks.

OR use the below expression and try you are able to get the correct format. thanks.

DateTime.ParseExact(Now.ToString(“MM/dd/yyy HH:mm”), “MM/dd/yyyy HH:mm”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM-dd-yyyy HH:mm”)

Hi @Nightowl_music

Try the below expression

DateTime.Now.ToString(“HH:mm”, System.Globalization.CultureInfo.CreateSpecificCulture(“RO”)).ToString

Regards
Gokul