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

Date/Time Format

Thread ID:

Created:

Updated:

Platform:

Replies:

573 Jul 9,2002 11:59 PM Jul 11,2002 10:43 AM Windows Forms 3
loading
Tags: FAQ
Administrator [Syncfusion]
Asked On July 9, 2002 11:59 PM

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 03:53 AM

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 04:38 AM

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 10:43 AM

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

CONFIRMATION

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.

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.

;