Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple Datetime format in form of YYYYMMDD

Tags:

c#

I have a little problem with time format I would like to get an output of the form YYYY-MM-DD given the datetime data input as 19901209 which is 1990-12-09.

I would also like to know if there is any way to get the data in other formats as well, for example, DD-MM-YYYY or MM-DD-YYYY given the data formated in the form as specified i.e 19901209.

Thank you so much in advance.

like image 401
Hoger Avatar asked Dec 04 '22 04:12

Hoger


1 Answers

DateTime.ParseExact("19901209", "yyyyMMdd",null).ToString("yyyy-MM-dd")
like image 130
L.B Avatar answered Dec 05 '22 17:12

L.B