Friday, September 7, 2018

Date Time in asp.net and Formats

     1)
       using System.Globalization;
       CultureInfo cul = new CultureInfo("FR-fr");
       string f1 = DateTime.Parse(txtFrom.Text.Trim(), cul).ToString("yyyy-MM-dd");
        string t1 = DateTime.Parse(txtTo.Text.Trim(), cul).ToString("yyyy-MM-dd");


  2)pick month
       
          DateTime DY = DateTime.Now;
          string MONTH = DY.ToString("MMM");

 2)Pick Year from date

          string YEAR = DY.ToString("yyyy");
   

No comments: