Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to set my start time in a DateTimePicker control to 00:00 with the 24 hour clock.

 

I cannot change the time no matter what I do, it just tells me it is read only, or it could not convert the string to a datetime. So do you have to use the time NOW, or can it be selected at run time programatically???

 

 

 

       StartTime.CustomFormat = "yyyy-M-d:HH:mm"
       EndTime.CustomFormat = "yyyy-M-d:HH:mm"

       StartTime.Value = Convert.ToDateTime(DateTime.Today & ":00:00")

  • *Experts*
Posted

The Value and CustomFormat properties are not read-only, so

you should not have a problem setting them. You will have to

format the date to your custom format:

 

StartTime.Value = Convert.ToDateTime(DateTime.Today.ToString("yyyy-M-d:HH:mm"))

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...