Results 1 to 3 of 3

Thread: Retrieving The Date Format an A Compter.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240
    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
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Lightbulb

    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
  •  



Click Here to Expand Forum to Full Width