CSharp examples for System:DateTime Format
Method return date in format dd.mm.yyy
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from ww w . java2 s. c om*/ public class Main{ /// <summary> /// Method return date in format dd.mm.yyy /// </summary> /// <param name="date"></param> /// <returns></returns> public static string GetDateDottedStringFormat(this DateTime date) { var day = date.Day < 10 ? String.Format("0{0}", date.Day) : date.Day.ToString(); var month = date.Month < 10 ? String.Format("0{0}", date.Month) : date.Month.ToString(); return String.Format("{0}.{1}.{2}", day, month, date.Year); } }