Click to See Complete Forum and Search --> : want to get the system date format
harishks
September 22nd, 2001, 01:24 AM
can any one pls give the api code for
getting the system date format.
ie. dd/mm/yyyy or mm/dd/yyyy etc...
thanking u.
harish.
Greenu Sharma
September 22nd, 2001, 01:47 AM
Hi harishKS
Use this to get the short date format of ur system.The format will be on strformattype variable
on Error GoTo dataerror1
Dim strformattype As String
ret = RegOpenKey(HKEY_CURRENT_USER, "Control Panel\International", RETVAL)
ret = RegQueryValueEx(RETVAL, "sShortDate", 0, 0, ByVal 0, lDataBufSize)
strformattype = String(lDataBufSize, Chr$(0))
ret = RegQueryValueEx(RETVAL, "sShortDate", 0, 0, ByVal strformattype, lDataBufSize)
dataerror1:
harishks
September 22nd, 2001, 01:58 AM
sorry icouldnt run it..
as it was showing the error
saying that no sub or funtion defined.
harish.
Greenu Sharma
September 22nd, 2001, 02:08 AM
Const HKEY_CURRENT_USER = &H80000001
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
harishks
September 22nd, 2001, 02:11 AM
it worked well.
thnaku
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.