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
:wave:
Printable View
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
:wave:
Isn't it as simple as going to the Regional and Language Options?
Yap Its Simple
but how can v do it with Our Vb Code..........
:wave:
Aha! I feel very foolish. Apologies...
Maybe this link will help? If not, let me know and I'll do some more research.
Yeah Its Not Working ....
doenst Give Much Clew
Have to dig more for it............
:wave:
Ok then.
Paste this into a new project and run it.
VB Code:
Const LOCALE_SSHORTDATE = &H1F Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long Private Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String) As Boolean Private Sub Command1_Click() Dim lngLocale As Long lngLocale = GetSystemDefaultLCID() SetLocaleInfo lngLocale, LOCALE_SSHORTDATE, "MM/dd/yyyy" End Sub Private Sub Command2_Click() Dim lngLocale As Long lngLocale = GetSystemDefaultLCID() SetLocaleInfo lngLocale, LOCALE_SSHORTDATE, "dd/MM/yyyy" End Sub Private Sub Command3_Click() Text1.Text = Now 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.
Ok thanks That Worked fine for Short Date format ..........
Wat About Long Date format ...?
i want exactly the same... As Well :wave:
You should be able to use this:
VB Code:
Public Const LOCALE_SLONGDATE = &H20
There is more information here if you need it.
Thanks Finally Its Resolved................
Thanks a lot :thumb: