Skip to content

Instantly share code, notes, and snippets.

@oshanz
Created January 25, 2014 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oshanz/8612113 to your computer and use it in GitHub Desktop.
Save oshanz/8612113 to your computer and use it in GitHub Desktop.
jquery date as sql format
var now = new Date();
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
$('#datePicker').val(today);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment