Last post Jun 23, 2016 05:48 AM by aoshi_kh
Member
92 Points
406 Posts
Jun 23, 2016 03:07 AM|aoshi_kh|LINK
how to get datetime.now converted to string with this format DDMMYYHHMMSS
My code as this Dim dt As DateTime = DateTime.Now
Dim str As String = dt.ToString("DDMMYYHHMMSS")
But the format is not I want, how to format it become DDMMYYHHMMSS ?
dt value show #6/23/2016 11:05:24 AM#
str value become DD06YY1106SS
All-Star
18815 Points
3831 Posts
Jun 23, 2016 05:31 AM|Nan Yu|LINK
Hi aoshi_kh,
You could try to use below format :
Console.WriteLine(DateTime.Now.ToString("ddMMyyHHmmss"))
Best Regards,
Nan Yu
Jun 23, 2016 05:48 AM|aoshi_kh|LINK
Hi Nan Yu, this work perfectly, thank you so much.
Member
92 Points
406 Posts
datetime format
Jun 23, 2016 03:07 AM|aoshi_kh|LINK
how to get datetime.now converted to string with this format DDMMYYHHMMSS
My code as this Dim dt As DateTime = DateTime.Now
Dim str As String = dt.ToString("DDMMYYHHMMSS")
But the format is not I want, how to format it become DDMMYYHHMMSS ?
dt value show #6/23/2016 11:05:24 AM#
str value become DD06YY1106SS
All-Star
18815 Points
3831 Posts
Re: datetime format
Jun 23, 2016 05:31 AM|Nan Yu|LINK
Hi aoshi_kh,
You could try to use below format :
Best Regards,
Nan Yu
Member
92 Points
406 Posts
Re: datetime format
Jun 23, 2016 05:48 AM|aoshi_kh|LINK
Hi Nan Yu, this work perfectly, thank you so much.