John Lindal![]()
Useful functions for working with dates and times.
Examples of how to use the utility functions with the default date and time formatting. To use a different format, e.g., DD/MM/YYYY, modify the static properties of Y.DateTimeUtils. Refer to the unit tests for examples.
<script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2013.05.02-22-59'
}).use('gallery-datetime-utils', function(Y)
{
var date = new Date(2012, 5, 11, 14, 5, 0, 0);
console.log(Y.DateTimeUtils.formatDate(date));
console.log(Y.DateTimeUtils.formatDate({year:2012, month:6, day:11}));
var date2 = Y.DateTimeUtils.parseDate('2012-06-11');
console.log(Y.DateTimeUtils.formatTime(date));
console.log(Y.DateTimeUtils.formatTime({hour:14, minute:5}));
var time = Y.DateTimeUtils.parseTime('14:05');
var time2 = Y.DateTimeUtils.parseTime('2:05 PM');
});
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info