Hi
I was wondering what the best way to display the date and time is? Below is what i believe to be the correct '.NET' way - but to me it just seems stupidly long and awkward.
The other way, is more of a bring a cross from VB6 and is below, but to me this seems far superior.
What is the benefit of one method over another? Also is there a better way of doing this?
Thanks.
I was wondering what the best way to display the date and time is? Below is what i believe to be the correct '.NET' way - but to me it just seems stupidly long and awkward.
Visual Basic:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim moment As New DateTime
moment = DateTime.Now
MsgBox(moment.Hour & ":" & moment.Minute & ":" & moment.Second & " " & moment.Day & "/" & moment.Month & "/" & moment.Year)
End Sub
The other way, is more of a bring a cross from VB6 and is below, but to me this seems far superior.
Visual Basic:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MsgBox(Format(Now, "hh:mm:ss dd/MM/yyyy"))
End Sub
What is the benefit of one method over another? Also is there a better way of doing this?
Thanks.