Sign in to follow this  
Followers 0
mr_unreliable

Date/Time Function "_DateTimeFormat()" for win9x u

2 posts in this topic

The "_DateTimeFormat()" function (as found in the date.au3 include file) expects to find the date/time locale-format-related info in the registry. Apparently this is true if one is using nt or xp. It is not true for a win9x system, (or, at least not _my_ win0x system). There are vb source code sites that address this issue (for example, Randy Birch), and which assert that to get those constants for ANY system, one must make use of the "GetLocaleInfo" api. The code attached to this posting, shows the "_DateTimeFormat()" function converted from using the registry to using that api, just in case there are any other win9x users out there.

I encountered one other "sticky wicket". Once I had the "_DateTimeFormat()" working for me, it is producing a result like this: "mm/dd/yy hh:mm:ss am/pm" -- which is appropriate for the U.S.A. However, the authors of the "_DateIsValid()" function are apparently Euro-centric, in that my "mm/dd/yy hh:mm:ss am/pm" was declared to be invalid. The only acceptable format for the "_DateIsValid()" function is this: "yyyy/mm/dd[ hh:mm[:ss]]". Perhaps I need to work on an "IsDateValid_ForYourLocale()" function, which would be more accepting of the date/time format commonly used in the U.S.A.

cheers, jw

win9x_DateTimeFormat.au3

Share this post


Link to post
Share on other sites



The "_DateTimeFormat()" function (as found in the date.au3 include file) expects to find the date/time locale-format-related info in the registry.  Apparently this is true if one is using nt or xp.  It is not true for a win9x system, (or, at least not _my_ win0x system).  There are vb source code sites that address this issue (for example, Randy Birch), and which assert that to get those constants for ANY system, one must make use of the "GetLocaleInfo" api.  The code attached to this posting, shows the "_DateTimeFormat()" function converted from using the registry to using that api, just in case there are any other win9x users out there. 

I encountered one other "sticky wicket".  Once I had the "_DateTimeFormat()" working for me, it is producing a result like this: "mm/dd/yy hh:mm:ss am/pm" -- which is appropriate for the U.S.A.  However, the authors of the "_DateIsValid()" function are apparently Euro-centric, in that my "mm/dd/yy hh:mm:ss am/pm" was declared to be invalid.  The only acceptable format for the "_DateIsValid()" function is this: "yyyy/mm/dd[ hh:mm[:ss]]".  Perhaps I need to work on an "IsDateValid_ForYourLocale()" function, which would be more accepting of the date/time format commonly used in the U.S.A.

cheers, jw

<{POST_SNAPBACK}>

I knew about win9X having a problem with the _DateTimeFormat() but don't have a simple solution.

_DateIsValid() is not Eurocentric, but is using the ISO 8601 format and it handles is one of the following:

"yyyy/mm/dd[ hh:mm[:ss]]"

"yyyy/mm/dd[Thh:mm[:ss]]"

"yyyy-mm-dd[ hh:mm[:ss]]"

"yyyy-mm-dd[Thh:mm[:ss]]"

"yyyy.mm.dd[ hh:mm[:ss]]"

"yyyy.mm.dd[Thh:mm[:ss]]"

;)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0