---
title: Time.From – แปลงค่าเป็นเวลา
url: https://www.thepexcel.com/functions/power-query/time-functions/time-from/
type: function-explainer
program: Power Query
syntax: "Time.From(value as any, optional culture as nullable text) as nullable time"
date: 2025-12-12
updated: 2025-12-17
scores:
  popularity: 6
  difficulty: 2
  usefulness: 6
---

# Time.From – แปลงค่าเป็นเวลา

> แปลงค่าต่างๆ เป็นค่าเวลา

## คำอธิบาย

Time.From แปลงค่าต่างๆ เช่น ข้อความ ตัวเลข DateTime เป็นค่าเวลา ฟังก์ชันนี้มีประโยชน์เมื่อต้องการแปลงข้อมูลเวลาจากรูปแบบข้อความหรือรูปแบบอื่นๆ มาเป็นค่าเวลาที่ถูกต้อง

## Syntax

```excel
Time.From(value as any, optional culture as nullable text) as nullable time
```

**Variant**

```excel
Time.From("14:30:00")
```

แปลงข้อความ "14:30:00" เป็นค่าเวลา

**Variant**

```excel
Time.From(#datetime(2025, 1, 1, 15, 45, 0))
```

แปลง DateTime เป็นค่าเวลา (เก็บเฉพาะส่วนเวลา)

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| value | Yes | any |  | ค่าที่ต้องการแปลงเป็นเวลา (ข้อความ ตัวเลข DateTime) |
| culture | No | nullable text | null | รหัสวัฒนธรรมเพื่อระบุรูปแบบเวลา (เช่น "en-US", "th-TH") |

## เคสการใช้งาน

### แปลงเวลาจากข้อความ

แปลงข้อมูลเวลาที่นำเข้าจากแหล่งข้อมูลอื่นเป็นค่าเวลาที่ถูกต้อง

_เหมาะกับ:_ time-conversion

### สำรวจส่วนเวลาจาก DateTime

แยกเฉพาะส่วนเวลาออกจากค่า DateTime

_เหมาะกับ:_ time-extraction

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: แปลงข้อความเป็นเวลา

```excel
Time.From("14:30:45")
```

**ผลลัพธ์:** `14:30:45`

แปลงข้อความ "14:30:45" เป็นค่าเวลา 14:30:45

### 2. ตัวอย่างที่ 2: แปลง DateTime เป็นเวลา

```excel
Time.From(#datetime(2025, 12, 31, 23, 59, 59))
```

**ผลลัพธ์:** `23:59:59`

แยกเฉพาะส่วนเวลา 23:59:59 จาก DateTime

### 3. ตัวอย่างที่ 3: แปลงตัวเลขเป็นเวลา

```excel
Time.From(0.5)
```

**ผลลัพธ์:** `12:00:00`

ตัวเลข 0.5 แทนครึ่งวัน ซึ่งคือ 12 ชั่วโมง

## หมายเหตุเพิ่มเติม

⚠️ ข้อสังเกต: Time.From สามารถแปลงค่าเพิ่มเติมนอกเหนือจากเวลาตามปกติ เช่น ตัวเลขทศนิยมที่แทนส่วนของวัน (0.5 = 12 ชั่วโมง)

## คำถามที่พบบ่อย

**Q: Time.From กับ Time.Parse ต่างกันอย่างไร**

Time.From เป็นฟังก์ชันที่ยืดหยุ่นกว่า รองรับค่าได้หลายประเภท ส่วน Time.Parse เป็นฟังก์ชันที่เคร่งครัดสำหรับแปลงข้อความเท่านั้น

**Q: สามารถระบุรูปแบบเวลาเฉพาะได้หรือไม่**

ได้ โดยใช้พารามิเตอร์ culture เช่น "en-US" หรือ "th-TH" เพื่อระบุรูปแบบเวลาของวัฒนธรรมต่างๆ

## ฟังก์ชันที่เกี่ยวข้อง

- time-parse
- [DateTime.From – แปลงค่าเป็น DateTime](https://www.thepexcel.com/functions/power-query/datetime-functions/datetime-from/)
- [Date.From – แปลงข้อมูลต่างประเภทเป็นวันที่](https://www.thepexcel.com/functions/power-query/date-functions/date-from/)
- [Duration.From](https://www.thepexcel.com/functions/power-query/duration-functions/duration-from/)

## แหล่งข้อมูลเพิ่มเติม

- [Microsoft Learn: Time.From](https://learn.microsoft.com/en-us/powerquery-m/time-from) _(documentation)_

---

_Source: [https://www.thepexcel.com/functions/power-query/time-functions/time-from/](https://www.thepexcel.com/functions/power-query/time-functions/time-from/)_
