-1
可能重複:
Is there any way to change input type=「date」 format?HTML 5日期格式
請問我們能在HTML 5要更改日期格式輸入?目前,我的網站正在顯示MM-DD-YYYY,但我希望它顯示DD-MM-YYYY。
可能重複:
Is there any way to change input type=「date」 format?HTML 5日期格式
請問我們能在HTML 5要更改日期格式輸入?目前,我的網站正在顯示MM-DD-YYYY,但我希望它顯示DD-MM-YYYY。
我這麼認爲,在HTML中沒有DD-MM-YYYY格式的語法。請參閱此page。有點它會幫助你。或者你可以在javascript中試試這個:
<script language="JavaScript">
<!-- Begin
// Get today's current date.
var now = new Date();
// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
// Array list of months.
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
// Calculate four digit year.
function fourdigits(number){
return (number < 1000) ? number + 1900 : number;
}
// Join it all together
today = days[now.getDay()] + ", " +
months[now.getMonth()] + " " +
date + ", " +
(fourdigits(now.getYear())) ;
// Print out the data.
document.write(today);
// End -->
</script>