• Register
  • Log In
  • Home
  • Quick Start
    • Configurator
    • Download YUI 3
  • Documentation
    • User Guides
    • Examples
    • API Docs
    • Environments
    • Tutorials
  • Community
    • Gallery
    • Blog
    • Forums
    • YUI Theater
    • Calendar
  • Contribute
    • YUI on GitHub »
    • File a Ticket
    • View Tickets
    • Dashboard
  • Other Projects
    • Shifter »
    • Yogi »
    • YUI 2
    • YUI Doc »
    • YUI Test
    • YUI Website
    • YUI Compressor »
    • YUI Builder »
    • YUI PHP Loader
    • Grid Builder »
    • Skin Builder »
  • YUI
  • >
  • Community
  • >
  • Gallery

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • Yogi Documentation
  • Shifter Documentation
  • Developer Guide
  • Module Setup

Tag Cloud

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    Date/Time Utilities (gallery-datetime-utils) on cdn

    Last Updated: 04/7/13
    + 0 -

    John Lindal

    YUI Contributor

    See 50 more by this user.

    Created: 06/11/12
    Last CDN Push: 05/2/13
    Build Tag: gallery-2013.05.02-22-59
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.5.1
    Free for use.

    Useful functions for working with dates and times.

    • Tags:
    • jafl
    • time
    • date
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    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.

    Code Sample

    <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