Int to string to date

I am using asp.net

i has int (10112009)

at the end I want the date form to be day-day / month month / yyyy

what's the best way (or way) to do this?

thanks

+4
source share
1 answer

I would do something like this:

int n = 10112009; DateTime date; if (DateTime.TryParseExact(n.ToString("00000000"), "ddMMyyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out date)) { // use date } 
+2
source

Source: https://habr.com/ru/post/1302583/


All Articles