代表者の戯言

I want to memorize them.It is about today's date and time.



Dim dt As DateTime = DateTime.Now


dt = dt.ToString


MessageBox.Show(dt) '(ex:Year2024 September17th 11hour26minute24sec →It shows 2024/09/27 11:26:24)



MessageBox.Show(dt.Year) '(ex:year2024 →It shows 2024)


MessageBox.Show(dt.Month) '(ex:September→It shows 9)


MessageBox.Show(dt.Day) '(ex:31th→It shows 31)


MessageBox.Show(dt.Hour) '(ex:hour 12→It shows12)


MessageBox.Show(dt.Minute) '(ex:50minute→It shows 50)


MessageBox.Show(dt.Second) '(ex:55sec→It shows 55)



' How to show today’s date?


MessageBox.Show(dt.ToShortDateString()) '(ex:2020/01/25)


MessageBox.Show(dt.ToLongDateString()) '(ex Japanese style:2020年1月25日)



' How to show today’s date and sec,etc?


MessageBox.Show(dt.ToLongTimeString()) '(ex 12hour24miute24sec→It shows 12:24:24)