I there a way to place the time part from a selected DateTimePicker DateTimeValue in a string variable so I can use it in this code?
Var theTime As String = DesktopDateTimePicker.DisplayModes.TimeOnly
MessageBox(theTime)
if theTime > 00:00 and theTime < 08:59 then
'WinStoryCalendarEvents.PopDayParts.SelectedRowIndex = 0
end if
Tim_Hare
(Tim Hare)
September 10, 2023, 8:55am
2
DateTime has properties for Hour and Minute. Use ToString("00")
to format them and combine them in the string you want.
I don’t see hour, minute or DateTime properties for the DateTimePicker, how is DateTime related to the DateTimePicker?
Tim_Hare
(Tim Hare)
September 10, 2023, 10:00am
4
DateTimePicker.SelectedDate is a DateTime. Ie., DateTimePicker returns a DateTime.
Tim_Hare
(Tim Hare)
September 10, 2023, 10:07am
5
Try
var d as DateTime = DesktopDateTimePicker1.SelectedDate
var hr as string = d.Hour.ToString("00")
var mn as string = d.Time.ToString("00")
var theTime as string = hr + ":" + mn
MessageBox(theTime)
1 Like