Changeset 103 for Include/Classes
- Timestamp:
- Feb 16, 2007, 6:58:51 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/DateTime.ab
r93 r103 13 13 Sub DateTime(ticks As Int64) 14 14 Ticks = ticks 15 Kind = Unspecified15 Kind = DateTimeKind.Unspecified 16 16 End Sub 17 17 … … 54 54 End Sub 55 55 56 /*Sub DateTime(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long, kind As DateTimeKind)56 Sub DateTime(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long, kind As DateTimeKind) 57 57 DateTime(year, month, day, hour, minute, second) 58 58 Kind = kind 59 End Sub */59 End Sub 60 60 61 61 Sub DateTime(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long, millisecond As Long) … … 199 199 Dim time As SYSTEMTIME 200 200 GetLocalTime(time) 201 Dim date As DateTime(time, Local)201 Dim date As DateTime(time, DateTimeKind.Local) 202 202 Return date 203 203 End Function … … 206 206 Dim time As SYSTEMTIME 207 207 GetLocalTime(time) 208 Dim date As DateTime(time.wYear, time.wMonth, time.wDay, Local)208 Dim date As DateTime(time.wYear, time.wMonth, time.wDay, DateTimeKind.Local) 209 209 Return date 210 210 End Function … … 213 213 Dim time As SYSTEMTIME 214 214 GetSystemTime(time) 215 Dim date As DateTime(time, Utc)215 Dim date As DateTime(time, DateTimeKind.Utc) 216 216 Return date 217 217 End Function … … 304 304 If (year Mod 100) = 0 Then Return False 305 305 If (year Mod 4) = 0 Then Return True 306 Return False 306 307 End Function 307 308 … … 357 358 FileTimeToSystemTime(localTime, time) 358 359 359 Dim date As DateTime(time, Local)360 Dim date As DateTime(time, DateTimeKind.Local) 360 361 Return date 361 362 End Function … … 382 383 FileTimeToSystemTime(fileTime, time) 383 384 384 Dim date As DateTime(time, Utc)385 Dim date As DateTime(time, DateTimeKind.Utc) 385 386 Return date 386 387 End Function … … 389 390 Dim fileTime As FILETIME 390 391 fileTime = ToFileTime() 391 If Kind = Utc Then392 If Kind = DateTimeKind.Utc Then 392 393 ToFileTimeUtc = fileTime 393 394 Else … … 397 398 398 399 Function ToLocalTime() As DateTime 399 If Kind = Local Then400 If Kind = DateTimeKind.Local Then 400 401 ToLocalTime = This 401 402 Else 402 403 ToLocalTime = DateTime.FromFileTime(ToFileTime()) 403 ToLocalTime.Kind = Local404 ToLocalTime.Kind = DateTimeKind.Local 404 405 End If 405 406 End Function 406 407 407 408 Function ToUniversalTime() As DateTime 408 If Kind = Utc Then409 If Kind = DateTimeKind.Utc Then 409 410 ToUniversalTime = This 410 411 Else 411 412 ToUniversalTime = DateTime.FromFileTimeUtc(ToFileTimeUtc()) 412 ToUniversalTime.Kind = Utc413 ToUniversalTime.Kind = DateTimeKind.Utc 413 414 End If 414 415 End Function … … 432 433 End Function 433 434 434 Function kindFromBinary(dateData As Int64) As Long435 Function kindFromBinary(dateData As Int64) As DateTimeKind 435 436 dateData = (dateData >> 62) And &H03 436 437 If dateData = &H01 Then 437 Return Local438 Return DateTimeKind.Local 438 439 ElseIf dateData = &H02 Then 439 Return Unspecified440 Return DateTimeKind.Unspecified 440 441 ElseIf dateData = &H03 Then 441 Return Utc442 Return DateTimeKind.Utc 442 443 End If 443 444 End Function 444 445 End Class 445 446 446 ConstEnum DateTimeKind447 Enum DateTimeKind 447 448 Local 448 449 Unspecified … … 450 451 End Enum 451 452 452 ConstEnum DayOfWeek453 Enum DayOfWeek 453 454 Sunday = 0 454 455 Monday
Note:
See TracChangeset
for help on using the changeset viewer.