Changeset 73


Ignore:
Timestamp:
Jan 23, 2007, 10:03:13 PM (13 years ago)
Author:
OverTaker
Message:

GetDateTimeFormats実装

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/DateTime.ab

    r40 r73  
    338338    End Function
    339339
    340     'まだ適当です
    341340    Function GetDateTimeFormats() As String
    342         Return Str$(Year) + "/" + Str$(Month) + "/" + Str$(Day) + " " + Str$(Hour) + ":" + Str$(Minute) + ":" + Str$(Second)
     341        Return GetDateTimeFormats(NULL)
     342    End Function
     343
     344    Function GetDateTimeFormats(format As *Byte) As String
     345        Dim time As SYSTEMTIME
     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()
     355        End With
     356
     357        Dim size As Long
     358        size = GetDateFormat(LOCALE_USER_DEFAULT, 0, time, format, NULL, 0)
     359        GetDateTimeFormats.ReSize(size - 1)
     360        GetDateFormat(LOCALE_USER_DEFAULT, 0, time, format, GetDateTimeFormats, size)
     361
     362        Dim temp As String     
     363        If format = NULL Then
     364            size = GetTimeFormat(LOCALE_USER_DEFAULT, 0, time, format, NULL, 0)
     365            temp.ReSize(size - 1)
     366            GetTimeFormat(LOCALE_USER_DEFAULT, 0, time, format, temp, size)
     367            GetDateTimeFormats = GetDateTimeFormats + " " + temp
     368        Else
     369            size = GetTimeFormat(LOCALE_USER_DEFAULT, 0, time, GetDateTimeFormats, NULL, 0)
     370            temp.ReSize(size - 1)
     371            GetTimeFormat(LOCALE_USER_DEFAULT, 0, time, GetDateTimeFormats, temp, size)
     372            GetDateTimeFormats = temp
     373        End If
    343374    End Function
    344375
Note: See TracChangeset for help on using the changeset viewer.