Am pm

ckbseng

Member
Joined
Sep 18, 2008
Messages
15
Programming Experience
3-5
does vb.net have the component to display the time only with the specific AM,PM?
i know that VS 2008 got datetimepicker as choose the date and time
but does it can display in term of the AM and PM?

if got any better solution and component about display and set the time, please left a message, TQ:)
 
Is ToShortTimeString what you are looing for?

dim myTime as new DateTime

myTime = now()
MessageBox.show(myTime.ToShortTime)

Does this help?

Bernie
 
no..
i want is the "Component" like datetimepicker, can it show the time format in term of AM and PM, or any other tool that can show also in AM and PM
of cause it can use to put time into the slot giving.etc
 
Have a look at the Format property, Time is an option. AM/PM is a culture thing and I don't use it, so if the Time option don't display your time letters you can go for the Custom option.
 
As JohnH says, you can display any format you want in a DateTimePicker by setting the Format to Custom and then setting the CustomFormat to any valid date and/or time format string. MSDN can tell you all the valid standard and custom date and time format strings. I could provide you with the format string you need to answer this question but that would just be giving you a fish. I suggest that you go to MSDN and do the reading so you know all the formats for when you're bound to need them in the future.

date time format strings - MSDN Search
 
jmcilhinney,
zzz, i just want to ensure the vs2008's datetimepicker or other else tool that can let me utilize with the time.
what u measure that same as the john said only, no other point already besides calling ppl to study MSDN(are you MSDN staff)?
also didnt provide any link to the MSDN site, that is no point whatever you said
 
AM/PM in datetimepicker

i use customFormat to specified the format that i need
but like hh:mm tt should display in 12:23 PM but it only display 12:23 and the "tt" missing already
did i write the format wrong already?
 
ckbseng said:
hh:mm tt should display in 12:23 PM but it only display 12:23 and the "tt" missing already
That must mean your computer is configured for a culture that doesn't use those letters. DTP is a OS common control that takes setting from there (see link), even if you set different culture for your application than the computer configuration. You can change computer culture configuration from 'Regional and language options' in Control panel. If you do so the standard Time format normally include the 12-hour letters by default for cultures that use this format, else you can also customize any culture and use it along with a DTP Custom format.

links: The DateTimePicker and MonthCalendar control do not reflect the CurrentUICulture property of an application's main execution thread when you created a localized application in the .NET Framework, in Visual Studio 2005, or in Visual Studio .NET

Why did you start a new thread for your last post, by the way? I merged it back here.
 
i very appreciate what you post here John,
thank you again, i able to solve the problem already

but 1 more thing is still the datetimepicker, when i click on it, it only display or pump up a box to select the date but time no.
if the time is just can use keyboard enter only or datetimepicker can display a box to adjust the time?
if nt the datetimepicker can said as "datepicker" because it can function more in date but time no :)
 
Back
Top