Write Iso Date (Year-Month-Day) - CSharp System

CSharp examples for System:DateTime Format

Description

Write Iso Date (Year-Month-Day)

Demo Code


using System.Text;
using System.Globalization;
using System.Collections.Specialized;
using System.Collections;
using System;/*from www  .  j  a v  a2s .c o m*/

public class Main{
        /// <summary>
        /// Write Iso Date (Year-Month-Day)
        /// </summary>
        public static string WriteIsoDate( DateTime date )
        {
            return date.Year + "-" +
                date.Month.ToString( "00" ) + "-" +
                date.Day.ToString( "00" );
        } // WriteIsoDate(date)
}

Related Tutorials