Make a SQLite Date from this DateTime - CSharp System

CSharp examples for System:DateTime Parse

Description

Make a SQLite Date from this DateTime

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from  ww  w . j av a2  s  .  co m

public class Main{
        /// <summary>
        /// Make a SQLite Date from this
        /// </summary>
        /// <param name="toAdapt">this to adapt</param>
        /// <returns>Adapted date</returns>
        public static string ToSqLiteFormat(this DateTime toAdapt)
        {
            return toAdapt.Year + "-" + (toAdapt.Month > 9 ? string.Empty + toAdapt.Month : "0" + toAdapt.Month) + "-" + (toAdapt.Day > 9 ? string.Empty + toAdapt.Day : "0" + toAdapt.Day);
        }
}

Related Tutorials