Date.IsWeekEnd() is a new method that returns if a date is a week end.
[GB.UTIL] * NEW: Date.IsWeekEnd() is a new method that returns if a date is a week end.
This commit is contained in:
parent
37a11f35c5
commit
7ffe5ff169
3 changed files with 13 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
|||
[Component]
|
||||
Key=gb.util
|
||||
Version=3.12.90
|
||||
Version=3.13.90
|
||||
State=1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Gambas Project File 3.0
|
||||
Title=Gambas utilities
|
||||
Startup=MMain
|
||||
Version=3.12.90
|
||||
Version=3.13.90
|
||||
VersionFile=1
|
||||
TabSize=2
|
||||
Language=fr
|
||||
|
|
|
@ -7,14 +7,14 @@ Private $dEpoch As Date
|
|||
|
||||
Public Sub ToUnixTime({Date} As Date) As Long
|
||||
|
||||
If Not $dEpoch Then $dEpoch = DateAdd(Date(1970, 1, 1), gb.Second, - System.TimeZone)
|
||||
If Not $dEpoch Then $dEpoch = DateAdd(Date(1970, 1, 1), gb.Second, -System.TimeZone)
|
||||
Return DateDiff($dEpoch, {Date}, gb.Second)
|
||||
|
||||
End
|
||||
|
||||
Public Sub FromUnixTime(UnixTime As Long) As Date
|
||||
|
||||
If Not $dEpoch Then $dEpoch = DateAdd(Date(1970, 1, 1), gb.Second, - System.TimeZone)
|
||||
If Not $dEpoch Then $dEpoch = DateAdd(Date(1970, 1, 1), gb.Second, -System.TimeZone)
|
||||
Return $dEpoch + UnixTime / 86400
|
||||
|
||||
End
|
||||
|
@ -80,9 +80,9 @@ Private Sub GetRFC822Zone(sZone As String) As Float
|
|||
Case "PST"
|
||||
fZone = -8
|
||||
Case Like "[A-I]"
|
||||
fZone = - (Asc(sZone) - 64)
|
||||
fZone = -(Asc(sZone) - 64)
|
||||
Case Like "[J-M]"
|
||||
fZone = - (Asc(sZone) - 65)
|
||||
fZone = -(Asc(sZone) - 65)
|
||||
Case Like "[N-Y]"
|
||||
fZone = Asc(sZone) - 77
|
||||
Case Like "[+-][0-1][0-9][0-5][0-9]"
|
||||
|
@ -152,3 +152,10 @@ Catch
|
|||
Error.Raise("Not a RFC822 date format")
|
||||
|
||||
End
|
||||
|
||||
Public Sub IsWeekEnd({Date} As Date) As Boolean
|
||||
|
||||
Dim iDay As Integer = WeekDay({Date})
|
||||
If iDay = gb.Sunday Or If iDay = gb.Saturday Then Return True
|
||||
|
||||
End
|
||||
|
|
Loading…
Reference in a new issue