How to Convert string to date? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to Convert string to date?

I have value of strings 31121990, how to convert that value to Date dd/MM/yyyy or dd MMM yyyy

29th Jun 2016, 10:11 PM
Jaka Ardita
Jaka Ardita - avatar
3 Answers
+ 3
You can use Convert.ToDateTime (date); which returns Datetime object.
30th Jun 2016, 6:07 AM
Venkatesh(Venki)
Venkatesh(Venki) - avatar
0
or you can use string.format and the letter at the end of the line
30th Jun 2016, 6:37 AM
Máté Lencsés
Máté Lencsés - avatar
0
string date=31121990; DateTime dt=Convert.ToDateTime (date);
2nd Jul 2016, 11:10 PM
Safik Rahman
Safik Rahman - avatar