To File Date Time - CSharp System

CSharp examples for System:DateTime Format

Description

To File Date Time

Demo Code

// Copyright (c)2008-2011 Mark II Software, LLC.  All Rights Reserved.
using System.Text;
using System.Collections.Generic;
using System;//w ww . j  av  a2s .co  m

public class Main{
        // Format as YYYYMMDD
        public static string ToFileDateTime(this DateTime dt)
        {
            return dt.ToString("yyyyMMdd-hhmmss");
        }
}

Related Tutorials