milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home
  3. JavaScript
  4. Moment

Formating date

Details
Written by: Stanko Milosev
Category: Moment
Published: 29 October 2013
Last Updated: 29 October 2013
Hits: 3636

I was playing little with jQuery UI datePicker, and Moment.js library, and here you can see result of it. Also, that source can be used for jQuery UI development, since I extracted only necessary files.

In my example most important are these two lines of code: 

var $myDate = $( "#datepicker" ).datepicker( "getDate" );
var $formatedMyDate = moment($myDate).format('YYYY-MM-DD hh:mm');

As you can see with line:

moment($myDate).format('YYYY-MM-DD hh:mm');

Date $myDate, I am formating to format YYYY-MM-DD hh:mm