 |
|
|
 |
 |
|
อ้างอิงมาจาก MSDN ของ VB6.0
Syntax : FormatDateTime(Date[, NamedFormat])
NumedFormat มีดังนี้
vbLongDate 1 Display a date using the long date format specified in your computer's regional settings.
vbShortDate 2 Display a date using the short date format specified in your computer's regional settings.
vbLongTime 3 Display a time using the time format specified in your computer's regional settings.
vbShortTime 4 Display a time using the 24-hour format (hh:mm).
ตัวอย่าง
Function GetCurrentDate
GetCurrentDate = FormatDateTime(Date, 1)
End Function
|
 |
 |
 |
 |
Date :
24 มิ.ย. 2549 10:36:31 |
By :
mr.asp_pyp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Thank you verymuch
|
 |
 |
 |
 |
Date :
24 มิ.ย. 2549 14:31:51 |
By :
catmatin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
//ทำการเก็บข้อมูล
a_day=Cstr(day(date)) //เก็บวันที่
a_month=Cstr(month(date)) //เก็บเดือน
a_year=Cstr(year(date)) //เก็บปี
//สร้างตัวแปรอาเรย์
MyMonth=Array("","ม.ค.","ก.พ.","มี.ค.","ม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.")
//เขียนโค๊ดเพื่อแสดงผล
ปกติ
response.write a_day&" : "&a_month&" : "&a_year //จะได้ผลลับเท่ากับ 24 : 6 : 2006
เปลี่ยนเป็นไทย
response.write a_day&" : "&MyMonth(a_month)&" : "&a_year //จะได้ผลลับเท่ากับ 24 : มิ.ย. : 2006
เปลี่ยน ค.ศ. เป็น พ.ศ.
response.write a_day&" : "&MyMonth(a_month)&" : "&a_year+543 //จะได้ผลลับเท่ากับ 24 : มิ.ย. : 2549

|
 |
 |
 |
 |
Date :
24 มิ.ย. 2549 16:37:42 |
By :
sCuzzyFIN |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|