Changeset 81 for Include/Classes
- Timestamp:
- Jan 31, 2007, 10:04:14 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/DateTime.ab
r73 r81 13 13 Sub DateTime(ticks As Int64) 14 14 Ticks = ticks 15 Kind = DateTimeKind.Unspecified15 Kind = 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) … … 166 166 For i = 1 To 12 167 167 day -= DaysInMonth(year, i) 168 If day < 0 Then Return i168 If day <= 0 Then Return i 169 169 Next 170 170 Return 12 … … 177 177 End Function 178 178 179 Function DayOfWeek() As Long179 Function DayOfWeek() As DayOfWeek 180 180 Return totalDays() Mod 7 - 1 181 181 End Function 182 182 183 Function Kind() As Long183 Function Kind() As DateTimeKind 184 184 Return kindFromBinary(m_Date) 185 185 End Function … … 199 199 Dim time As SYSTEMTIME 200 200 GetLocalTime(time) 201 Dim date As DateTime(time, DateTimeKind.Local)201 Dim date As DateTime(time, 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, DateTimeKind.Local)208 Dim date As DateTime(time.wYear, time.wMonth, time.wDay, 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, DateTimeKind.Utc)215 Dim date As DateTime(time, Utc) 216 216 Return date 217 217 End Function … … 345 345 Dim time As SYSTEMTIME 346 346 With time 347 .wYear = Year 348 .wMonth = Month 349 .wDay = Day 350 .wHour = Hour 351 .wMinute = Minute 352 .wSecond = Second 353 .wMilliseconds = Millisecond 354 .wDayOfWeek = DayOfWeek() 347 .wYear = Year As Word 348 .wMonth = Month As Word 349 .wDay = Day As Word 350 .wHour = Hour As Word 351 .wMinute = Minute As Word 352 .wSecond = Second As Word 353 .wMilliseconds = Millisecond As Word 354 .wDayOfWeek = DayOfWeek() As Word 355 355 End With 356 356 … … 388 388 Dim time As SYSTEMTIME 389 389 FileTimeToSystemTime(localTime, time) 390 Dim date As DateTime(time, DateTimeKind.Local)390 Dim date As DateTime(time, Local) 391 391 Return date 392 392 End Function … … 411 411 Dim time As SYSTEMTIME 412 412 FileTimeToSystemTime(fileTime, time) 413 Dim date As DateTime(time, DateTimeKind.Utc)413 Dim date As DateTime(time, Utc) 414 414 Return date 415 415 End Function … … 427 427 428 428 Function ToLocalTime() As DateTime 429 ToLocalTime = DateTime.FromFileTime(ToFileTimeUtc()) 430 ToLocalTime.Kind = DateTimeKind.Local 429 If Kind = Utc Then 430 ToLocalTime = DateTime.FromFileTime(ToFileTimeUtc()) 431 ToLocalTime.Kind = Local 432 Else 433 ToLocalTime = This 434 End If 435 End Function 436 437 Function ToUniversalTime() As DateTime 438 If Kind = Local Then 439 ToUniversalTime = DateTime.FromFileTimeUtc(ToFileTimeUtc()) 440 ToUniversalTime.Kind = Utc 441 Else 442 ToUniversalTime = This 443 End If 431 444 End Function 432 445 Private … … 452 465 dateData = (dateData >> 62) And &H03 453 466 If dateData = &H01 Then 454 Return DateTimeKind.Local467 Return Local 455 468 ElseIf dateData = &H02 Then 456 Return DateTimeKind.Unspecified469 Return Unspecified 457 470 ElseIf dateData = &H03 Then 458 Return DateTimeKind.Utc471 Return Utc 459 472 End If 460 473 End Function 461 474 End Class 462 475 463 Enum DateTimeKind476 Const Enum DateTimeKind 464 477 Local 465 478 Unspecified … … 467 480 End Enum 468 481 469 Enum DayOfWeek482 Const Enum DayOfWeek 470 483 Sunday = 0 471 484 Monday
Note:
See TracChangeset
for help on using the changeset viewer.