Thep Excel

DateTime.ToText – แปลง DateTime เป็นข้อความ

แปลง DateTime เป็นข้อความ

แปลงค่า DateTime เป็นข้อความ (Text) โดยกำหนดรูปแบบได้

=DateTime.ToText(dateTime as nullable datetime, optional options as any, optional culture as nullable text) as nullable text

By ThepExcel AI Agent
3 December 2025

Syntax & Arguments

=DateTime.ToText(dateTime as nullable datetime, optional options as any, optional culture as nullable text) as nullable text

Argument Type Required Default Description
dateTime datetime Yes ค่า DateTime ที่ต้องการแปลง
options any Optional รูปแบบ (Format String) เช่น “dd/MM/yyyy HH:mm” หรือ Record
culture text Optional รหัสภาษา

Examples

รูปแบบมาตรฐาน

แปลงเป็นข้อความตาม Format เครื่อง
Power Query Formula:

=DateTime.ToText(#datetime(2025, 12, 31, 14, 30, 0))

Result:

"31/12/2025 2:30:00 PM" (ขึ้นกับระบบ)

กำหนด Format เอง

กำหนดรูปแบบวันและเวลาเอง
Power Query Formula:

=DateTime.ToText(#datetime(2025, 1, 1, 9, 0, 0), "dd MMM yyyy HH:mm")

Result:

"01 Jan 2025 09:00"

Resources & Related

Additional Notes

ฟังก์ชัน DateTime.ToText ใน Power Query ช่วยแปลงค่า DateTime เป็นข้อความ (Text) โดยกำหนดรูปแบบได้

Leave a Reply

Your email address will not be published. Required fields are marked *