Brian Boatright Brian Boatright - 5 months ago 8
Vb.net Question

Simplest method to determine if the current time is AM or PM?

What is the best method to determine if the current time is AM or PM using VB.NET?

Currently I'm using If Date.Today.ToString.Contains("AM") but I'm sure there is a better method.

Good <%If Date.Today.ToString.Contains("AM") Then Response.Write("Morning") Else Response.Write("Afternoon")%>

Answer

If Date.Now.Hour < 12 Then ... perhaps?

Comments