Wednesday, April 29, 2009

Get Date Format

'Get Date Format



Private Type SYSTEMTIME

    wYear As Integer

    wMonth As Integer

    wDayOfWeek As Integer

    wDay As Integer

    wHour As Integer

    wMinute As Integer

    wSecond As Integer

    wMilliseconds As Integer

End Type



Private Declare Function GetDateFormat
Lib "kernel32"
Alias _

"GetDateFormatA" (ByVal Locale As Long, ByVal dwFlags As Long, _

lpDate As SYSTEMTIME, ByVal lpFormat
As String, _

ByVal lpDateStr As String, ByVal cchDate As Long) As Long



Private Sub Form_Load()

Dim Buffer As String, ST
As SYSTEMTIME



ST.wDay = 25

ST.wMonth = 4

ST.wYear = 2009



Buffer = String(255, 0)

GetDateFormat ByVal 0&, 0, ST, vbNullString, Buffer, Len(Buffer)

Buffer = Left$(Buffer, InStr(1, Buffer, Chr$(0)) - 1)

MsgBox Buffer

End Sub



 

No comments:

Post a Comment