' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' [2009_05_03_AM_11_45_30] ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
'
' Public Module LocalTools_Y2009M05D03
'
' Version 1.00.01; Last Updated on [2009-05-03-AM-10-54-58]
'
Public Module LocalTools_Y2009M05D03
Public Function GetStandardDateStampWithWeekdayIndex_Y2009M05D03(Optional ByVal AnyDate As Date = Nothing) As String
' (本段程式之目的) Purpose:
' Return a StandardDateStampWithWeekdayIndex like
'
' 2009-05-03-WD7
'
' where 1 is the WeekdayIndex of Monday
' where 2 is the WeekdayIndex of Tuesday
' where 3 is the WeekdayIndex of Wednesday
' where 4 is the WeekdayIndex of Thursday
' where 5 is the WeekdayIndex of Friday
' where 6 is the WeekdayIndex of Saturday
' where 7 is the WeekdayIndex of Sunday
'
' 2009-05-03-WD7
' 2009-05-04-WD1
' 2009-05-05-WD2
' 2009-05-06-WD3
' 2009-05-07-WD4
' 2009-05-08-WD5
' 2009-05-09-WD6
' 2009-05-10-WD7
' 2009-05-11-WD1
' 2009-05-12-WD2
' 2009-05-13-WD3
' 2009-05-14-WD4
' 2009-05-15-WD5
' 2009-05-16-WD6
' 2009-05-17-WD7
'
' (本段程式是否已經在被使用中) In use: Yes
' (程式撰寫的進度) Developing: 100% (Mandatory)
' (程式堪用的程度) Workable: 80% (Threshold at 80%)
' (程式的測試程度) Code tested: 70% (max 99%)
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
' (修改程式的日期) Revision Date: (2009 05 03 AM 10 44 38)
' (修改程式的人員) Revised by: WeiJin Tang (湯偉晉)
' OK
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dim D As Date
If AnyDate = Nothing Then
D = DateTime.Today
Else
D = AnyDate
End If
Dim myTextWith4DigitsYearIndex As String
myTextWith4DigitsYearIndex = D.Year.ToString.PadLeft(4, "0")
Dim myTextWith2DigitsMonthIndex As String
myTextWith2DigitsMonthIndex = D.Month.ToString.PadLeft(2, "0")
Dim myTextWith2DigitsDayIndex As String
myTextWith2DigitsDayIndex = D.Day.ToString.PadLeft(2, "0")
Dim myTextWith1DigitWeekDayIndex As String
' myTextWith1DigitWeekDayIndex = D.DayOfWeek
'
' GetStandardDayOfWeekIndexUsedByWeiJinTang_Y2009M05D03
' is a supporting function used by this function.
'
myTextWith1DigitWeekDayIndex = GetStandardDayOfWeekIndexUsedByWeiJinTang_Y2009M05D03(D)
Dim SB As New System.Text.StringBuilder
With SB
.Append(myTextWith4DigitsYearIndex)
.Append("-")
.Append(myTextWith2DigitsMonthIndex)
.Append("-")
.Append(myTextWith2DigitsDayIndex)
.Append("-WD")
.Append(myTextWith1DigitWeekDayIndex)
End With
Dim myDateStamp As String
myDateStamp = SB.ToString
Return myDateStamp
End Function ' GetStandardDateStampWithWeekdayIndex_Y2009M05D03
Public Function GetStandardDayOfWeekIndexUsedByWeiJinTang_Y2009M05D03(ByVal AnyDate As Date) As Integer
' (本段程式之目的) Purpose:
' Return a StandardWeekdayIndex used by WeiJin Tang
'
' where 1 is the WeekdayIndex of Monday
' where 2 is the WeekdayIndex of Tuesday
' where 3 is the WeekdayIndex of Wednesday
' where 4 is the WeekdayIndex of Thursday
' where 5 is the WeekdayIndex of Friday
' where 6 is the WeekdayIndex of Saturday
' where 7 is the WeekdayIndex of Sunday
'
' (本段程式是否已經在被使用中) In use: Yes
' (程式撰寫的進度) Developing: 100% (Mandatory)
' (程式堪用的程度) Workable: 80% (Threshold at 80%)
' (程式的測試程度) Code tested: 70% (max 99%)
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
' (修改程式的日期) Revision Date: (2009 05 03 AM 11 30 09)
' (修改程式的人員) Revised by: WeiJin Tang (湯偉晉)
' OK
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dim D As Date
D = AnyDate
Dim myDayOfWeekIndex As Integer
myDayOfWeekIndex = D.DayOfWeek
If myDayOfWeekIndex = 0 Then
' Here, we define the index of Sunday as 7 instead of 0
Return 7
Else
Return myDayOfWeekIndex
End If
End Function ' GetStandardDayOfWeekIndexUsedByWeiJinTang_Y2009M05D03
End Module ' LocalTools_Y2009M05D03
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' [2009_05_03_AM_11_45_30] ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '