|
 |
|
ต้องการเปลี่ยน format วันที่จากเดือน Feb เป็น 02 เป็นต้นครับ |
|
 |
|
|
 |
 |
|
จากกระทู้นี้ครับ https://www.thaicreate.com/community/jquery-datepicker.html
คืออยากเปลี่ยนวันที่จาก 2014-Feb-12 ให้เป็น 2014-02-12 อะครับ จะเข้าไปเปลี่ยนตรงไหนได้บ้างครับ
Code (PHP)
<script type="text/javascript">
$(function(){
var startDateTextBox = $('#dateStart');
var endDateTextBox = $('#dateEnd');
startDateTextBox.datepicker({
dateFormat: 'dd-M-yy',
onClose: function(dateText, inst) {
if (endDateTextBox.val() != '') {
var testStartDate = startDateTextBox.datetimepicker('getDate');
var testEndDate = endDateTextBox.datetimepicker('getDate');
if (testStartDate > testEndDate)
endDateTextBox.datetimepicker('setDate', testStartDate);
}
else {
endDateTextBox.val(dateText);
}
},
onSelect: function (selectedDateTime){
endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
}
});
endDateTextBox.datepicker({
dateFormat: 'dd-M-yy',
onClose: function(dateText, inst) {
if (startDateTextBox.val() != '') {
var testStartDate = startDateTextBox.datetimepicker('getDate');
var testEndDate = endDateTextBox.datetimepicker('getDate');
if (testStartDate > testEndDate)
startDateTextBox.datetimepicker('setDate', testEndDate);
}
else {
startDateTextBox.val(dateText);
}
},
onSelect: function (selectedDateTime){
startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
}
});
});
</script>
Start Date : <input type="text" name="dateStart" id="dateStart" value="" />
End Date : <input type="text" name="dateEnd" id="dateEnd" value="" />
Tag : PHP, MySQL, HTML/CSS, JavaScript, Ajax, jQuery

|
|
 |
 |
 |
 |
Date :
2014-02-10 12:20:13 |
By :
littlebeer |
View :
901 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รองเปลี่ยนตรง
Code (JavaScript)
dateFormat = 'dd-M-yy'
เป็น
Code (JavaScript)
dateFormat = 'yyyy-MM-dd'
|
 |
 |
 |
 |
Date :
2014-02-10 13:20:49 |
By :
Nameless |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่ได้ครับ yyyy มันจะเติมเป็น 20142014 2 ครั้งเลย
MM จะกลายเป็นเดือนเต็ม February เลย
|
 |
 |
 |
 |
Date :
2014-02-10 13:27:18 |
By :
littlebeer |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากครับบ นิดเดียวจริง ๆ 55
|
 |
 |
 |
 |
Date :
2014-02-11 15:57:22 |
By :
littlebeer |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|