Time (hour) question

  • Thread starter Thread starter ReidarT
  • Start date Start date
R

ReidarT

On the load event of a VB.NET web-form I use format(DateTime.Now,"HH:mm") to
get the time in a textfield.
I want the field to show the next half hour, like 12:30, 13:00, 13:30 and so
on. How can I add something to the
code to achieve this?
regards
reidarT
 
How about something like (not tested)

dim currentDate AS date = Date.now
DIm formattedTime AS string

IF currentDate.minute < 30 Then
formattedTime = Format(currentDate, "HH:") & "30"
Else
formattedTime = Format(currentDate.AddHour(1), "HH:") & "00"
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top