To show date in long mode :
DateTimePicker1.Value.ToLongDateString()
Ex : Saturday, September 13, 2008
To show date in Short mode : DateTimePicker1.Value.ToShortDateString()
Ex : 9/13/2008
Jx_Man
Nearly a Senior Poster
3,328 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
>> now i only wanna display time...i try changing the format but it displays both time and date together....any idea?
To Show current date with long format :
FormatDateTime(TimeOfDay, DateFormat.LongTime)
Result : 10:40:05 PM
To Show current date with short format : FormatDateTime(Now,DateFormat.ShortTime)
Or FormatDateTime(TimeOfDay,DateFormat.ShortTime)
Result : 22:40 Visit this site, there are tutorial about Format() function.
Jx_Man
Nearly a Senior Poster
3,328 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
Using timer to check booking time with system time :
On Timer properties
- Set timer Enable = True
- Set Interval = 1000
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim btime As DateTime
btime = FormatDateTime("1:00:00 AM", DateFormat.LongTime)
If FormatDateTime(TimeOfDay, DateFormat.LongTime) = btime Then
MsgBox("Booking Time up")
End If
End Sub
Jx_Man
Nearly a Senior Poster
3,328 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
- using TimeSerial() Function to get 2 hours before booking time.
see this line bTimeUp = TimeSerial(btimeA.Hour - 2, btimeA.Minute, btimeA.Second)
Dim bTimeA As DateTime
Dim bTimeUp As DateTime
btimeA = FormatDateTime(btime1.Value, DateFormat.LongTime)
bTimeUp = TimeSerial(btimeA.Hour - 2, btimeA.Minute, btimeA.Second)
If FormatDateTime(TimeOfDay, DateFormat.LongTime) = bTimeUp Then
MsgBox("Booking Time up Mr/Miss " & Bcusname1.Text & " is late,reservation canceled")
Table1.BackColor = Color.PaleGreen
status1 = "Available"
End If
- question for u : btime1 is datetimepicker or not?
if yes then setFormat = Time on datepicker properties
Jx_Man
Nearly a Senior Poster
3,328 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
what problem come up?any errors?
Jx_Man
Nearly a Senior Poster
3,328 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444