How GetDateStringSpec Uses Its Element Array

One of the Newton 2.x OS Q&As
Copyright © 1997 Newton, Inc. All Rights Reserved. Newton, Newton Technology, Newton Works, the Newton, Inc. logo, the Newton Technology logo, the Light Bulb logo and MessagePad are trademarks of Newton, Inc. and may be registered in the U.S.A. and other countries. Windows is a registered trademark of Microsoft Corp. All other trademarks and company names are the intellectual property of their respective owners.


For the most recent version of the Q&As on the World Wide Web, check the URL: http://www.newton-inc.com/dev/techinfo/qa/qa.htm
If you've copied this file locally, click here to go to the main Newton Q&A page.
This document was exported on 7/23/97.


How GetDateStringSpec Uses Its Element Array (3/31/97)

Q: It appears that the compile-time function GetDateStringSpec formats the supplied date elements in reverse order. Is this is a bug?

A: This is the defined behavior. The Newton Programmer's Guide implies that the order does not matter, but that is not correct. GetDateStringSpec uses the elements in reverse order, although some functions that use dateStringSpecs may not observe the order defined by the dateStringSpec. For instance, some functions may use the elements of the dateStringSpec, but use the element ordering defined by the locale bundle.

For instance, you can use this call to define a dateStringSpec for use in a locale bundle with the order Day/Month/Year:
        GetDateStringSpec([[kElementYear, kFormatNumeric],[kElementMonth,
        kFormatNumeric],[kElementDay, kFormatNumeric] ]);