DateInRegion
Full Document
https://github.com/malcommac/SwiftDate/blob/master/Documentation/Index.md
Method Overview
| Name | Description | Return |
|---|
| init() | การ Initial Date ด้วย Timestamp | void |
| timestamp() | ค่า Timestamp ของ Date | Integer |
| toFormat() | แปลง Date ให้อยู่ในรูปของ String โดยสามารถ Custom รูปแบบของวันที่ที่จะแสดงได้ | String |
Method Details
init(timestamp: Int, region: Region)
การ Initial Date ด้วย Timestamp
Parameters
| Name | Description | Type |
|---|
| timestamp | ค่า Timestamp ที่ต้องการใช้ในการสร้าง Date | Int |
| region | Region สำหรับการสร้าง Date | Region |
func timestamp(_ style: TimestampFormatStyle = .second) -> Int
ค่า Timestamp ของ Date
Parameters
| Name | Description | Type |
|---|
| style | รูปแบบของ Timestamp ที่ต้องการ มีทั้งหมด 2 แบบ คือ แบบ Second และ Millisecond | TimestampFormatStyle |
Returns
| Type | Description |
|---|
| Int | Return Timestamp ของวันที่ในรูปแบบที่กำหนด |
func toFormat(_ format: String, region: Region?) -> String
แปลง Date ให้อยู่ในรูปของ String โดยสามารถ Custom รูปแบบของวันที่ที่จะแสดงได้
Parameters
| Name | Description | Type |
|---|
| format | รูปแบบของการแสดงผลวันที่ | String |
| region | Region ที่ต้องการใช้สำหรับการแสดงผลวันที่ | Optional(Region) |
Returns
| Type | Description |
|---|
| String | Return String ของวันที่ในรูปแบบการแสดงผลที่กำหนด |