|
-
Sep 19th, 2007, 03:40 PM
#1
Thread Starter
Hyperactive Member
Date Time Picker doesn't show Date & Time
I have a datetimepicker control where I want to show both the date and time but so far have not been able to do so.
I have the properties format set to custom and then through code I am trying to do this:
VB Code:
' Format DateTime
dtpShow.Value = CDate(dtShowDateTime.ToString("u"))
dtpStart.Value = CDate(dtStartDateTime.ToString("u"))
dtpEnd.Value = CDate(dtStopDateTime.ToString("u"))
At run time the control is only showing Long or Short depending on the properties. I want to show it like this: 2007-9-18 00:00:00
-
Sep 19th, 2007, 03:46 PM
#2
Re: Date Time Picker doesn't show Date & Time
When you set the format to custom, also set the CustomFormat property to the format you want.
To match the example you gave, use a CustomFormat of "yyyy-M-dd hh:mm:ss"
-
Sep 19th, 2007, 03:49 PM
#3
Re: Date Time Picker doesn't show Date & Time
You need to set the CustomFormat property of your datetimepicker control
This should do it:
Code:
DateTimePicker1.Format = DateTimePickerFormat.Custom
DateTimePicker1.CustomFormat = "yyyy-M-dd HH:mm:ss"
-
Sep 20th, 2007, 10:42 AM
#4
Thread Starter
Hyperactive Member
Re: Date Time Picker doesn't show Date & Time
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|