HomeVisual Basic技術項目 日時

日時

日付加算、減算

Private Function getDateTime(ByVal format As DateFormat) As String

    Dim dateTime As Date = Now

    dateTime = DateAdd(DateInterval.Year, Convert.ToDouble(0), dateTime)
    dateTime = DateAdd(DateInterval.Month, Convert.ToDouble(0), dateTime)
    dateTime = DateAdd(DateInterval.Day, Convert.ToDouble(0", "DAY")), dateTime)

    Return FormatDateTime(dateTime, format)

End Function

日時ID作成

Private Function getNewTimeId() As String

    Dim alphabet As String = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    Dim dateTime As Date = Now

    Dim newId As String = ""
    newId &= dateTime.Year.ToString("0000").Substring(2, 2)
    newId &= alphabet.Substring(dateTime.Month, 1)
    newId &= alphabet.Substring(dateTime.Day, 1)
    newId &= alphabet.Substring(dateTime.Hour, 1)
    newId &= dateTime.Minute.ToString("00")
    newId &= dateTime.Second.ToString("00")

    Return newId

End Function



ページトップへ

データベース

サーバ

Copyright (C) MadCap. All Rights Reserved.