NSTimeZone
NSTimeZone 表示时区信息,通常与 NSDateFormatter 配合使用。
类成员 (Class members)
Section titled “类成员 (Class members)”systemTimeZone
Section titled “systemTimeZone”系统时区。
static systemTimeZone(): NSTimeZoneReturn Value:
NSTimeZone: 系统时区实例。
localTimeZone
Section titled “localTimeZone”本地时区。
static localTimeZone(): NSTimeZoneReturn Value:
NSTimeZone: 本地时区实例。
timeZoneWithName
Section titled “timeZoneWithName”从时区名创建。
static timeZoneWithName(name: string): NSTimeZoneParameters:
| Name | Type | Description |
|---|---|---|
name | string | 时区名(如 “Asia/Shanghai”)。 |
Return Value:
NSTimeZone: 新时区实例。
实例成员 (Instance members)
Section titled “实例成员 (Instance members)”时区名称。
name(): stringReturn Value:
string: 时区名。
secondsFromGMTForDate
Section titled “secondsFromGMTForDate”某日期在该时区相对 GMT 的秒数偏移。
secondsFromGMTForDate(date: NSDate): numberParameters:
| Name | Type | Description |
|---|---|---|
date | NSDate | 日期。 |
Return Value:
number: 秒数偏移。