ฟังก์ชันVBScript FormatDateTime
❮ การอ้างอิง VBScript ที่สมบูรณ์
ฟังก์ชัน FormatDateTime จัดรูปแบบและส่งกลับนิพจน์วันที่หรือเวลาที่ถูกต้อง
ไวยากรณ์
FormatDateTime(date,format)
Parameter | Description |
---|---|
date | Required. Any valid date expression (like Date() or Now()) |
format |
Optional. A value that specifies the date/time format to use
Can take the following values:
|
ตัวอย่าง
ตัวอย่าง
แสดงวันที่ในรูปแบบต่างๆ:
<%
d=CDate("2019-05-31 13:45")
response.write(FormatDateTime(d) & "<br />")
response.write(FormatDateTime(d,1) & "<br />")
response.write(FormatDateTime(d,2) & "<br />")
response.write(FormatDateTime(d,3) & "<br />")
response.write(FormatDateTime(d,4) & "<br />")
%>
ผลลัพธ์ของโค้ดด้านบนจะเป็น:
5/31/2019 1:45:00 PM
Friday, May 31, 2019
5/31/2019
1:45:00 PM
13:45
❮ การอ้างอิง VBScript ที่สมบูรณ์