public static string GetBirthDate(int daysOld) { var dateToday = Convert.ToInt32(DateTime.Now); var calc = (dateToday - 365.25 * daysOld); return Convert.ToString(calc); }
public static DateTime(int days) { return new DateTime.Now.Subtract(TimeSpan.FromDays(days)); }
int daysOld = 1095; DateTime dob = DateTime.Now.AddDays(daysOld * -1);
public static string GetBirthDate(int daysOld) { // DateTime.Now.AddDays(-daysOld).To... has many format options // beware AddDays: daysOld conversion to type double return DateTime.Now.AddDays(-daysOld).ToString("dd'/'MM'/'yyyy") }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)