0
How to convert Datetime.now.year to two digits? Ex: 2021 to 21
My code:
Dim ok As String = DateTime.Now.Year.ToString("yy")
shortyear.text = ok
Prints "yy"
0
How to convert Datetime.now.year to two digits? Ex: 2021 to 21
My code:
Dim ok As String = DateTime.Now.Year.ToString("yy")
shortyear.text = ok
Prints "yy"
0
Okay, I managed to solve the problem the easy way.
Dim TimeFormat As String = "yy"
Sub Yearget()
yearprint.Text = Convert.ToDateTime(voyagedate.Value).ToString(TimeFormat)
End Sub
Browser other questions tagged visual-studio vb.net
You are not signed in. Login or sign up in order to post.
just do
Dim ok As String = DateTime.Now.ToString("yy")
see the example– Augusto Vasques
Thank you very much, I tested and it worked too...
– Abd Domingos