昨日の日付を表示するVBスクリプトです。

現在の日付を求めるために別の関数を呼んでいます。


Option Explicit

  Dim STR_Yesterday
  Dim STR_Temp

  STR_Temp = Get_YYYYMMDD(1)
  STR_Yesterday = DateAdd("d",-1,STR_Temp)

  WScript.Echo STR_Yesterday
Private Function Get_YYYYMMDD(ByVal STR_Flag)
  Dim STR_Temp
  Dim STR_YYYY
  Dim STR_MM
  Dim STR_DD

  If Not IsNumeric(STR_Flag) Then Exit Function End If

  STR_Temp = Year(Now)
  If Len(STR_Temp) = 2 Then STR_Temp = "20" & STR_Temp End If
  STR_YYYY = STR_Temp

  STR_Temp = Month(Now())
  If Len(STR_Temp) = 1 Then STR_Temp = "0" & STR_Temp End If
  STR_MM = STR_Temp

  STR_Temp = Day(Now())
  If Len(STR_Temp) = 1 Then STR_Temp = "0" & STR_Temp End If
  STR_DD = STR_Temp

  Select Case STR_Flag

    Case 0

      GET_YYYYMMDD = STR_YYYY & STR_MM & STR_DD

    Case 1

      GET_YYYYMMDD = STR_YYYY & "/" &  STR_MM & "/" & STR_DD    

    Case 2

      GET_YYYYMMDD = "#" & STR_DD & "/" & STR_MM & "/" & STR_YYYY & "#"

  End Select

End Function

Scriptのダウンロードは こちら です。

8 Comments

  1. gửi hàng đi mỹ says:

    … [Trackback]

    […] Read More to that Topic: dragon-ark.com/archives/120 […]

  2. W88casino says:

    … [Trackback]

    […] There you will find 58828 more Info to that Topic: dragon-ark.com/archives/120 […]

  3. Darknet Links says:

    … [Trackback]

    […] Read More on that Topic: dragon-ark.com/archives/120 […]

  4. exchange online plan 2 says:

    … [Trackback]

    […] Info on that Topic: dragon-ark.com/archives/120 […]

  5. adsl teknik servis says:

    … [Trackback]

    […] Find More on that Topic: dragon-ark.com/archives/120 […]

  6. it danışmanlık ücretleri says:

    … [Trackback]

    […] Info on that Topic: dragon-ark.com/archives/120 […]

  7. Sunucu Teknik Servis says:

    … [Trackback]

    […] Read More on to that Topic: dragon-ark.com/archives/120 […]

  8. HP Server Teknik Destek says:

    … [Trackback]

    […] Information on that Topic: dragon-ark.com/archives/120 […]

Leave a Reply