We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Date/Time Format

I want the time to show in military format such that 1:00PM should appear as 13:00. When the user inputs 1:00 in the textbox, I wrote some codes in the textbox's LEave event to format the textbox into long time as below but it doesn't work. This code just truncates the txtTime.text = FormatDateTime(txtTime.text, DateFormat.LongTime) all it does is change the time to include seconds such as 1:00:00 PM. but i don't want that. How do I format it to military time?

3 Replies

CB Clay Burch Syncfusion Team July 10, 2002 07:53 AM UTC

In the help on FormatDateTime, it says that DateFormat.LongTime uses the system settings. If you want to use 24 hour format, it says to use DateFormat.ShortTime.


AD Administrator Syncfusion Team July 11, 2002 08:38 AM UTC

But it's not one of the options! if i try to format datetime.shorttime, i get an error. it's not one of the choices that comes up when i press the "dot" after the datetime! why is that?


CB Clay Burch Syncfusion Team July 11, 2002 02:43 PM UTC

In your original code, you had DateFormat.LongTime. I am suggesting DateFormat.ShortTime as in:
txtTime.text = FormatDateTime(txtTime.text, 
DateFormat.ShortTime)

Loader.
Up arrow icon