how do i output like datetimepicker.text to a listbox...
I tried datetimepicker1.text but it did not work....can someone help me please
my code is like this...

Rpanel.Hide()

Plistbox.Items.Add("Customer Name" & ControlChars.Tab & _
ControlChars.Tab & "Booking Date" & ControlChars.Tab & _
ControlChars.Tab & "Booking Time")

Plistbox.Items.Add(Bcusname.Text & ControlChars.Tab & _
ControlChars.Tab & Bdate.Value & ControlChars.Tab & _
ControlChars.Tab & btime1)

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

hay,
i hope it will be worked.you concatenate now to others that it will display current day,month and time.
eg., ListBox1.Items.Add(Now)
reply please.,

thanks jx..its working....
and yes silam its working too...but now i have another problem...i can display date and time...

now i only wanna display time...i try changing the format but it displays both time and date together....any idea?

>> 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.

now i only wanna display time...i try changing the format but it displays both time and date together....any idea?

hay,
thats not a problem man i can help u. use the following ,u can obtain separately,
"M/d/yy" 12/19/07
"MM-dd-yy" 12-19-07
hh:mm:ss 11:27:07
hh:mm:ss tt 11:27:07 AM
u can use this inside your format.
eg., TextBox1.Text = Format(Now, "hh:mm:ss")
reply pls.,

thanks alot for your help jx and silam....

say guys can u help with system time...

i have a booking time

eg.

i set the booking time at 1.00 Am,then once the booking equals to system time a messagebox appears....

can i do sumthin like this:

btime.text = date.now

??

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

hey thank for your help jx_man....my project is 50% complete....i need help with this problem too...appretiate your help.

here is my code

If tableno = 1 Then
            status = "Booked"
            Table1.BackColor = Color.Khaki
            Spanel.Hide()
            Rpanel1.Show()

Dim btimeA As DateTime
        btimeA = FormatDateTime(btime1.Value, DateFormat.LongTime)
        If FormatDateTime(TimeOfDay, DateFormat.LongTime) = btimeA.AddMinutes(20) Then
            MsgBox("Booking Time up Mr/Miss " & Bcusname1.Text & " is late,reservation canceled")
            Table1.BackColor = Color.PaleGreen
            status1 = "Available"

How do set the timer to start 2 hours b4 the booking time?...lets say the booking is at 7, the button will be yellow at 5 only...i try a few ways its not working.....would really appreciate your help...

- 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 set Format = Time on datepicker properties

thanks again for your jx....i don't understand a few things....will u explain them...thank u...here is my updated code

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Dim btimeA As DateTime
        btimeA = FormatDateTime(Btime1.Value, DateFormat.LongTime)
        If FormatDateTime(TimeOfDay, DateFormat.LongTime) = btimeA.AddMinutes(20) Then
            MsgBox("Booking Time up Mr/Miss " & Bcusname1.Text & " is late,reservation canceled")
            Table1.BackColor = Color.PaleGreen
            status2 = "Available"
        End If
    End Sub

As you can see the above one is for the
timer....i would like to place the btimeUp in the button,coz once i click the button it changes in yellow...so, i decided to put the btimeup in the button...i did something like this...

Private Sub bubu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RButton.Click
        If tableno = 1 Then
Dim bTimeUp As DateTime
bTimeUp = TimeSerial(btime1.Hour - 2, btime1.Minute, btime1.Second)
If TimeSerial(TimeOfDay, DateFormat.LongTime, DateFormat.LongTime) Then 
            status1 = "Booked"
            Table1.BackColor = Color.Khaki
            Spanel.Hide()
            Rpanel1.Show()
        End If

But somehow this line is giving problem

bTimeUp = TimeSerial(btime1.Hour - 2, btime1.Minute, btime1.Second)

can u help me out with this....

what problem come up?any errors?

bTimeUp = TimeSerial(Btime1.Hour - 2, Btime1.Minute, Btime1.Second)

this line says tat 'hour' is not a member of ' System.Windows.Forms.DateTimePicker'

This line says

If TimeSerial(TimeOfDay, DateFormat.LongTime, DateFormat.LongTime)

value type date cannot be converted into integer....

i'm really confused now...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.