r/visualbasic • u/[deleted] • Jun 08 '12
Need help with some coding time?
What I need the time output in a 24 hour output to look like: 07:53 or 14:34
What I have
Dim todaystime As Date
todaystime = Format(Now,"hh:mm")
what this outputs
3:00:00 AM
need:
03:00
5
Upvotes
6
Jun 08 '12
The extra :00 AM is being added because that's the default format when you output a Date object. Use a String instead to control the output.
Dim todaystime As String = Date.Now.ToString("hh:mm")3
3
u/[deleted] Jun 08 '12
both worked.....Man you guys ROCK ;O)