Page 1 of 1

System date format

Posted: Fri Apr 07, 2006 3:09 am
by USCode
There is a system date format, based on the user's OS preferences, for displaying dates. E.g. in Europe the date is typically displayed DD/MM/YYYY, whereas in the U.S. it's MM/DD/YYYY ... it would be nice if there was a way to retrieve this format and/or have the data automatically formatted based on the user's regional preferences ... for both dates and times.

Perhaps as a set of Masks in the FormatDate() command?
e.g.
%SystemDateFormat
%SystemTimeFormat

would display the date or time in the format appropriate to the user's settings. I'm sure Fred could come up with a better solution!

Re: System date format

Posted: Mon Dec 18, 2006 9:49 am
by PB
I just found this post and here's a quick-and-dirty hack, just to point you in
the right direction. It's your responsibility to clean it up and make it work in
all situations. :)

Code: Select all

shortdate$=Space(10) : GetLocaleInfo_(#LOCALE_USER_DEFAULT,#LOCALE_SSHORTDATE,shortdate$,10)
Debug shortdate$

a$=ReplaceString(shortdate$,"/","/%")
a$=ReplaceString(a$,"d","%dd")
Debug FormatDate(a$,Date())