FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Windows Date Format
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Windows Date Format
Posted: Sat Feb 23, 2013 02:13 AM

Hi,

I've asked this before but never was able to get a solution...

How can I set the date format in my app to match the short date format set in Windows Regional Settings?

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Windows Date Format
Posted: Sat Feb 23, 2013 02:33 AM
I figured out a way to do it :-)

For anyone else looking for a solution ... Here is what I came up with:

Code (fw): Select all Collapse
#define HKEY_CURRENT_USER 2147483649 

SET DATE FORMAT TO GetSysDate()


Code (fw): Select all Collapse
Function GetSysDate()
    LOCAL oReg, c := "Control Panel\International"
    oReg := TReg32():New( HKEY_CURRENT_USER ,c , .F.)
    cSysDate := oReg:Get("sShortDate", "" )
    oReg:Close()
Return cSysDate
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion