Friday, 29 November 2019

How to get month,day and year from birth date

How to get month,day and year from birth date


Use this

   string birthDate = "2015/02/01";
   var split = birthDate.Split('/');
    If you get birthDate from database as datetime, you can extract date parts from it like:

    DateTime birthDate = DateTime.Now.Date;

    var year = birthDate.Year;
    var month = birthDate.Month;
    var day = birthDate.Day;

I hope this may help you

No comments:

Post a Comment