0

Hello
I want to change date format to insert date in mysql. I tried as below code

<script type="text/javascript">
	$(function() {
    $("#datepicker").formatDate('yyyy-mm-dd');
		$("#datepicker").datepicker();
	});
	</script>

but its not working form me. can anybody suggests me how to do it?

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by faulkj
0
var date = $('#datepicker').datepicker({ dateFormat: 'yyyy-mm-dd' });

Edited by pritaeas: n/a

0
<script type="text/javascript">
	$(function() {
    $("#datepicker").datepicker();
    $("#datepicker").formatDate('yyyy-mm-dd');
	});
	</script>

this worked for me.

0

I know it is kind of off topic, but check out this library:

http://plugins.jquery.com/project/fIsForFormat

It is the most useful thing I’ve found when it comes to Date formatting in JavaScript. Not only does it make formatting a piece of cake, but it has many other cool features as well!

I have no idea why it is listed as a jQuery plugin. I went through the code and couldn’t find any references to anything that looked like jQuery (or any other libraries for that matter.) I’ve used it standalone and it works just fine.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.