格式要求(例):on friday, july 14, 2017
我的思路是用js就可以实现了,具体代码如下:
1 <!doctype html> 2
<html lang="en"> 3 <head> 4
<meta charset="utf-8"> 5
<meta http-equiv="x-ua-compatible" content="ie=edge"> 6
<meta name="viewport" content="width=device-width, initial-scale=1"> 7
<!-- the above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> 8
<title>index</title> 9
</head>10
<body>11
<h1>hello, world!</h1>12
<p class="current-time"></p>13 14
<script src="https://code.jquery.com/jquery-2.2.4.js?1.1.11">
</script>15 16 <script type="text/javascript">17
$(function() {18 //全局对象19 //当前时间20
var curtime=new date()21 22 //枚举周天23
var weekday=new array(7);24 weekday[0]=sunday;25
weekday[1]=monday;26 weekday[2]=tuesday;27
weekday[3]=wednesday;28 weekday[4]=thursday;29
weekday[5]=friday;30 weekday[6]=saturday;31 32
//枚举月份33 var month=new array(12);34 month[0]=january;35
month[1]=february;36 month[2]=march;37 month[3]=april;38
month[4]=may;39 month[5]=june;40 month[6]=july;41
month[7]=august;42 month[8]=september;43
month[9]=october;44 month[10]=november;45
month[11]=december;46 47 //当前日期信息48
var strcurtime = on + weekday[curtime.getday()] +, +month[curtime.getmonth()] + + curtime.getdate() + , + curtime.getfullyear();49
$(.current-time).html(strcurtime);50 });51
</script>52 </body>53 </html>
以上就是javascript(jquery)打印英文格式日期的实例代码的详细内容。