コード例 #1
0
ファイル: utilDate.cs プロジェクト: ylatuya/chronojump-1
    //get a string of last month
    public static string GetCurrentYearLastMonthStr()
    {
        DateTime dt = DateTime.Now;

        dt = dt.AddMonths(-1);

        return(UtilAll.DigitsCreate(dt.Year, 4) + "-" + Catalog.GetString(dt.ToString("MMMM")));
    }
コード例 #2
0
ファイル: utilDate.cs プロジェクト: ylatuya/chronojump-1
 //records date & time, useful to backup database without having strange chars on filename
 public static string ToFile(DateTime dt)
 {
     return(UtilAll.DigitsCreate(dt.Year, 4) + "-" +
            UtilAll.DigitsCreate(dt.Month, 2) + "-" +
            UtilAll.DigitsCreate(dt.Day, 2) + "_" +
            UtilAll.DigitsCreate(dt.Hour, 2) + "-" +
            UtilAll.DigitsCreate(dt.Minute, 2) + "-" +
            UtilAll.DigitsCreate(dt.Second, 2));
 }
コード例 #3
0
ファイル: utilDate.cs プロジェクト: ylatuya/chronojump-1
 //comes datetime
 //insert in sql like YYYY-MM-DD (with always all digits)
 //we use Year, Month and Day for not having any problem with locale
 public static string ToSql(DateTime dt)
 {
     return(UtilAll.DigitsCreate(dt.Year, 4) + "-" +
            UtilAll.DigitsCreate(dt.Month, 2) + "-" +
            UtilAll.DigitsCreate(dt.Day, 2));
 }