DateInRegion

DateInRegion

Full Document

https://github.com/malcommac/SwiftDate/blob/master/Documentation/Index.md

Method Overview

NameDescriptionReturn
init()การ Initial Date ด้วย Timestampvoid
timestamp()ค่า Timestamp ของ DateInteger
toFormat()แปลง Date ให้อยู่ในรูปของ String โดยสามารถ Custom รูปแบบของวันที่ที่จะแสดงได้String

Method Details

init(timestamp: Int, region: Region)

การ Initial Date ด้วย Timestamp

Parameters

NameDescriptionType
timestampค่า Timestamp ที่ต้องการใช้ในการสร้าง DateInt
regionRegion สำหรับการสร้าง DateRegion
func timestamp(_ style: TimestampFormatStyle = .second) -> Int

ค่า Timestamp ของ Date

Parameters

NameDescriptionType
styleรูปแบบของ Timestamp ที่ต้องการ มีทั้งหมด 2 แบบ คือ แบบ Second และ MillisecondTimestampFormatStyle

Returns

TypeDescription
IntReturn Timestamp ของวันที่ในรูปแบบที่กำหนด
func toFormat(_ format: String, region: Region?) -> String

แปลง Date ให้อยู่ในรูปของ String โดยสามารถ Custom รูปแบบของวันที่ที่จะแสดงได้

Parameters

NameDescriptionType
formatรูปแบบของการแสดงผลวันที่String
regionRegion ที่ต้องการใช้สำหรับการแสดงผลวันที่Optional(Region)

Returns

TypeDescription
StringReturn String ของวันที่ในรูปแบบการแสดงผลที่กำหนด