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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Date/Time Format

Thread ID:





573 Jul 10,2002 03:59 AM UTC Jul 11,2002 02:43 PM UTC WinForms 3
Tags: FAQ
Administrator [Syncfusion]
Asked On July 10, 2002 03:59 AM UTC

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?

Clay Burch [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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?

Clay Burch [Syncfusion]
Replied On 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, 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon