时间函数涉及的数据类型:
DATA TYPES
datetime() = {date(), time()}
datetime1970() = {{year1970(), month(), day()}, time()}
date() = {year(), month(), day()}
year() = integer() >= 0
Year cannot be abbreviated. Example: 93 denotes year 93, not 1993. Valid range depends on the underlying OS. The date tuple must denote a valid date.
year1970() = 1970..10000
month() = 1..12
day() = 1..31
time() = {hour(), minute(), second()}
hour() = 0..23
minute() = 0..59
second() = 0..59
daynum() = 1..7
ldom() = 28 | 29 | 30 | 31
yearweeknum() = {year(), weeknum()}
weeknum() = 1..53
1.
返回当前 年月日的函数
erlang:date() -> Date
Type: Date = {year(), month(), day()}.
2.
返回当前系统的 年月日,时分秒
erlang:localtime() -> DateTime
Type: DateTime = {date(), time()}.
3.
返回当前时间戳
erlang:now() -> timestamp()
Type: timestamp() = {MegaSecs, Secs, MicroSecs}
返回从1970.1.1 0:00开始到现在的时间,
返回结果是 百万秒,秒,微妙
4.
返回当前系统的时分秒
time() -> {Hour, Minute, Second}
Hour = Minute = Second = integer() >= 0
5.
通过年月日算星期几
day_of_the_week(Date) -> daynum()
day_of_the_week(Year, Month, Day) -> daynum().
返回星期1到星期日的代号是1-7
6.
把秒转化为时间
seconds_to_daystime(Seconds) -> {Days, Time}.
Seconds = Days = integer()
Time = time().
7.
返回从当天0时到现在的秒数
time_to_seconds(Time) -> secs_per_day()
Types:
Time = time()
secs_per_day() = 0..86400
8.
DATA TYPES
datetime() = {date(), time()}
datetime1970() = {{year1970(), month(), day()}, time()}
date() = {year(), month(), day()}
year() = integer() >= 0
Year cannot be abbreviated. Example: 93 denotes year 93, not 1993. Valid range depends on the underlying OS. The date tuple must denote a valid date.
year1970() = 1970..10000
month() = 1..12
day() = 1..31
time() = {hour(), minute(), second()}
hour() = 0..23
minute() = 0..59
second() = 0..59
daynum() = 1..7
ldom() = 28 | 29 | 30 | 31
yearweeknum() = {year(), weeknum()}
weeknum() = 1..53
1.
返回当前 年月日的函数
erlang:date() -> Date
Type: Date = {year(), month(), day()}.
2.
返回当前系统的 年月日,时分秒
erlang:localtime() -> DateTime
Type: DateTime = {date(), time()}.
3.
返回当前时间戳
erlang:now() -> timestamp()
Type: timestamp() = {MegaSecs, Secs, MicroSecs}
返回从1970.1.1 0:00开始到现在的时间,
返回结果是 百万秒,秒,微妙
4.
返回当前系统的时分秒
time() -> {Hour, Minute, Second}
Hour = Minute = Second = integer() >= 0
5.
通过年月日算星期几
day_of_the_week(Date) -> daynum()
day_of_the_week(Year, Month, Day) -> daynum().
返回星期1到星期日的代号是1-7
6.
把秒转化为时间
seconds_to_daystime(Seconds) -> {Days, Time}.
Seconds = Days = integer()
Time = time().
7.
返回从当天0时到现在的秒数
time_to_seconds(Time) -> secs_per_day()
Types:
Time = time()
secs_per_day() = 0..86400
8.