Jump to content

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


mr_unreliable
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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]]"

;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...