查看: 823|回复: 5
|
asp 要怎样format date?
[复制链接]
|
|
<html>
<body>
<%
Response.Write(Request.QueryString("date"))
%>
<form action="formatdate.asp" method="get">
Enter a date :
<br>
<input type="text" name="date" value="1/2/2006 1:1:1: PM">
<br>
Select format string (Choices: 1 for mm/dd/yyyy 2 for dd/mm/yyyy 3 for dd/mm/yy):
<br>
<select name="dateformat">
<option value="1">
1
<option value="2">
2
<option value="3" >
3
</select>
</body>
</html>
请问要怎样弄?网上的只有教formatdatetime(date,vbshortdate)是给现在的时间而已,不能换user input的.
老师都不会教,只给几个function:
1. formatdatetime()
2. Day()
3. month()
4. year() |
|
|
|
|
|
|
|
发表于 8-3-2006 09:10 AM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 8-3-2006 04:53 PM
|
显示全部楼层
老师都给完Hints了嘛....
<%
'ASP Part
Dim sDay, sMonth, sYear, sShortYear
sDay = Day(Now)
If Day(Now) < 10 Then
sDay = "0" & Day(Now)
End If
If Month(Now) < 10 Then
sMonth = "0" & Month(Now)
Else
sMonth = Month(Now)
End If
Response.Write sMonth & "/" & sDay & "/" & sYear & "<br>"
Response.Write sDay & "/" & sMonth & "/" & sYear & "<br>"
Response.Write sDay & "/" & sMonth & "/" & sShortYear & "<br>"
%>
你要的是这样吧?将它改改套进去就是了.
若不是就用JavaScript Func validate InputBox & return the value to <select> |
|
|
|
|
|
|
|
楼主 |
发表于 8-3-2006 05:03 PM
|
显示全部楼层
原帖由 piekia119 于 8-3-2006 04:53 PM 发表
老师都给完Hints了嘛....
<%
'ASP Part
Dim sDay, sMonth, sYear, sShortYear
sDay = Day(Now)
If Day(Now) < 10 Then
sDay = "0" & Day(Now)
End If
If Month(Now) < 10 Th ...
我要的date是自己打的不是now的. |
|
|
|
|
|
|
|
发表于 8-3-2006 05:47 PM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 9-3-2006 08:38 AM
|
显示全部楼层
|
|
|
|
|
|
| |
本周最热论坛帖子
|