|
-
May 6th, 2000, 06:54 AM
#1
Thread Starter
Addicted Member
Hi,
I have two questions:
1) Is It Possible to Retrieve The Date Format on a computer?
If so then how?
2) Which Date Format does MS Access Database Use
-
May 6th, 2000, 07:16 AM
#2
Frenzied Member
for VB and access there's one format for date and Time called a DateTime in Access or a Date in VB, you can convert string to a date using the CDate() Function, you can retrieve the current date by using the Date keyword.
Code:
Dim dteToday as Date
dteToday = Date
-
May 6th, 2000, 11:58 PM
#3
1. You can use GetLocaleInfo to get date formats:
Code:
Option Explicit
Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Private Const LOCALE_USER_DEFAULT = &H400
Private Const LOCALE_SSHORTDATE = &H1F ' short date format string
Private Const LOCALE_SLONGDATE = &H20 ' long date format string
Private Sub Form_Load()
Dim strLocale As String
Dim lngRet As Long
Dim strMsg As String
'Get short date format
strLocale = Space(255)
lngRet = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, strLocale, Len(strLocale))
strLocale = Left(strLocale, lngRet - 1)
strMsg = "Short Date Format: " & strLocale
'Get long date format
strLocale = Space(255)
lngRet = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, strLocale, Len(strLocale))
strLocale = Left(strLocale, lngRet - 1)
strMsg = strMsg & vbCrLf & "Long Date Format: " & strLocale
MsgBox strMsg
End Sub
2. Access stores date as a long date format. So even if you setup a specific date format on that field, it still saves the date in the long format.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|