Results 1 to 9 of 9

Thread: Setting Long - Short Date format in Date Time Settings

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Posts
    83

    Setting Long - Short Date format in Date Time Settings

    How can i set the Date Time Setting Format in Control Panel

    i m usiing window Xp


    also i want the date format in dd/MM/yyyy



  2. #2
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Re: Setting Long - Short Date format in Date Time Settings

    Isn't it as simple as going to the Regional and Language Options?
    Attached Images Attached Images  
    This world is not my home. I'm just passing through.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Posts
    83

    Re: Setting Long - Short Date format in Date Time Settings

    Yap Its Simple
    but how can v do it with Our Vb Code..........

  4. #4
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Re: Setting Long - Short Date format in Date Time Settings

    Aha! I feel very foolish. Apologies...

    Maybe this link will help? If not, let me know and I'll do some more research.
    This world is not my home. I'm just passing through.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Posts
    83

    Re: Setting Long - Short Date format in Date Time Settings

    Yeah Its Not Working ....

    doenst Give Much Clew

    Have to dig more for it............

  6. #6
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Re: Setting Long - Short Date format in Date Time Settings

    Ok then.

    Paste this into a new project and run it.

    VB Code:
    1. Const LOCALE_SSHORTDATE = &H1F
    2. Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
    3. Private Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String) As Boolean
    4.  
    5. Private Sub Command1_Click()
    6.   Dim lngLocale As Long
    7.   lngLocale = GetSystemDefaultLCID()
    8.   SetLocaleInfo lngLocale, LOCALE_SSHORTDATE, "MM/dd/yyyy"
    9. End Sub
    10.  
    11. Private Sub Command2_Click()
    12.   Dim lngLocale As Long
    13.   lngLocale = GetSystemDefaultLCID()
    14.   SetLocaleInfo lngLocale, LOCALE_SSHORTDATE, "dd/MM/yyyy"
    15. End Sub
    16.  
    17. Private Sub Command3_Click()
    18.   Text1.Text = Now
    19. End Sub

    Command3 refreshes the time/date in TextBox1.

    Command1 sets up MM/dd/yyyy and Command2 sets up dd/MM/yyyy.


    As a test, run the code and do the following in order.
    1. Click Command 1
    2. Open a new instance of MSWord and press <SHIFT><ALT>D to enter a date.
    3. Close MSWord
    4. Click Command 2
    5. Open a new instance of MSWord and press <SHIFT><ALT>D to enter a date.


    The reason you have to open and close MSWord is that it appears to only pick up the date format when it is opened, not when the format changes.
    This world is not my home. I'm just passing through.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Posts
    83

    Re: Setting Long - Short Date format in Date Time Settings

    Ok thanks That Worked fine for Short Date format ..........
    Wat About Long Date format ...?
    i want exactly the same... As Well

  8. #8
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Re: Setting Long - Short Date format in Date Time Settings

    You should be able to use this:

    VB Code:
    1. Public Const LOCALE_SLONGDATE = &H20

    There is more information here if you need it.
    This world is not my home. I'm just passing through.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Posts
    83

    Re: Setting Long - Short Date format in Date Time Settings

    Thanks Finally Its Resolved................
    Thanks a lot

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