YUI 3.x Home -

YUI Library Examples: DataType Utility: DataType.Date.format()

Note: This is YUI 3.x. Looking for YUI 2.x?

DataType Utility: DataType.Date.format()

The Date module of the DataType Utility allows you to format a JavaScript Date object into a string with strftime syntax.

To format a JavaScript Date object into a string, simply call the format() function of the DataType.Date class. You may pass in optional format and locale values, but the default format value is "%F" and the default locale value is "en-US":

The format configuration property accepts strftime tokens:

The following locales are built-in and available by default: "en", "en-AU", "en-GB", and "en-US".

Additional locales may be added for your implementation:

The default format and locale may by defined globally via the Y.config configuration object:

Copyright © 2009 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings