
date_to_gregorian_days(Date) -> Days 获取到现在为止的天数
date_to_gregorian_days(Year, Month, Day) -> Days
datetime_to_gregorian_seconds(DateTime) -> Seconds 获取到现在为止的秒数
day_of_the_week(Date) -> daynum() 获取到现在为止的周数
day_of_the_week(Year, Month, Day) -> daynum()
gregorian_days_to_date(Days) -> date() calendar:gregorian_days_to_date( 20000 ) -> {54,10,4}
20000天是多少年多少月多少日
gregorian_seconds_to_datetime(Seconds) -> datetime() calendar:gregorian_seconds_to_datetime( 200000 ) -》{{0,1,3},{7,33,20}}
20万秒是多少年月日,时分秒
is_leap_year(Year) -> boolean() Year年数是否为闰年
iso_week_number() -> yearweeknum() This function returns the tuple {Year, WeekNum} representing the iso week number for the actual date. For determining the actual date, the function local_time/0 is used.
iso_week_number(Date) -> yearweeknum() 该年的第几周
last_day_of_the_month(Year, Month) -> LastDay calendar:last_day_of_the_month( 2014,3 ) -> 31
根据年月获取该月份的最后一天
local_time() calendar:local_time() -> {{2013,7,11},{16,25,46}}
local_time_to_universal_time(DateTime1) calendar:local_time_to_universal_time( {{2013,7,11},{16,25,46}} ) -> {{2013,7,11},{8,25,46}}
local_time_to_universal_time_dst(DateTime1) -> [DateTime] calendar:local_time_to_universal_time_dst( {{2013,7,11},{16,25,46}} ) -> [{{2013,7,11},{8,25,46}}]
now_to_local_time(Now) -> datetime1970() calendar:now_to_local_time( now() ) -> {{2014,5,23},{10,57,10}}
now()转化为datetime1970()
now_to_universal_time(Now) -> datetime1970() calendar:now_to_local_time( now() ) -> {{2014,5,23},{2,57,10}}
八小时时差
now_to_datetime(Now) -> datetime1970() calendar:now_to_local_time( now() ) -> {{2014,5,23},{2,57,10}}
默认UTC时间
seconds_to_daystime(Seconds) -> {Days, Time} calendar:seconds_to_daystime(1400774400) -> {16212,{16,0,0}}
Seconds秒转换为多少天时分秒
seconds_to_time(Seconds) -> time() 秒数转换为时分秒,不能超过一天
time_difference(T1, T2) -> {Days, Time} calendar:time_difference( {{2013,7,11},{16,25,46}}, {{2013,7,11},{8,25,46}} ) -> {-1,{16,0,0}}
time_to_seconds(Time) -> secs_per_day() 时分秒转换成秒
universal_time()
valid_date(Date) -> boolean()
valid_date(Year, Month, Day) -> boolean(). 验证是否存在日期
8>calendar:valid_date(2015, 2, 29).
false
9> calendar:valid_date(2015, 2, 28).
true
DateTime1 = DateTime = datetime1970()
This function converts from local time to Universal Coordinated Time (UTC). DateTime1 must refer to a local date after Jan 1, 1970.
The return value is a list of 0, 1 or 2 possible UTC times:
[]
For a local {Date1, Time1} during the period that is skipped when switching to daylight saving time, there is no corresponding UTC since the local time is illegal - it has never happened.
[DstDateTimeUTC, DateTimeUTC]
For a local {Date1, Time1} during the period that is repeated when switching from daylight saving time, there are two corresponding UTCs. One for the first instance of the period when daylight saving time is still active, and one for the second instance.
[DateTimeUTC]
For all other local times there is only one corresponding UTC.
- 1.学习
- 1.1安装与运行环境
- 1.2编辑器、集成开发环境与其它工具
- 1.3代码编译运行
- 2.基础
- 2.1 Erlang终端
- 2.2 基础语法
- 2.2.1 异常处理
- 2.3 数据类型
- 2.4 操作符
- 2.5 模块属性
- 3.库函数
- 3.1 常用模块
- 3.2 OTP模块
- 3.2.1 函数
- 3.2.2 receive
- 3.2.3 .app.src文件
- 3.2.4 _app.erl
- 3.2.5 _sup.erl
- 3.2.6 gen_server
- 3.2.7 gen_fsm
- 3.3 erts
- 3.3.1 init
- 3.3.2 BIF
- 3.3.3 NIF
- 3.4 kernel
- 3.4.1 code_server
- 3.4.2 inet
- 3.4.3 net_kernel
- 3.4.4 net_adm
- 3.4.5 error_logger
- 3.4.6 global
- 3.4.7 application
- 3.5 stdlib
- 3.5.2 array
- 3.5.4 base64
- 3.5.5 binary
- 3.5.6 c
- 3.5.8 calendar
- 3.5.9 code
- 3.5.11 dict
- 3.5.12 erl_
- 3.5.13 file
- 3.5.14 filelib
- 3.5.15 gb_trees
- 3.5.16 gb_sets
- 3.5.17 gen_tcp
- 3.5.18 gen_server
- 3.5.19 httpc
- 3.5.20 init_parse
- 3.5.21 init
- 3.5.22 inet
- 3.5.23 io
- 3.5.24 lists
- 3.5.25 maps
- 3.5.26 os
- 3.5.27 ordsets
- 3.5.28 proplists
- 3.5.29 queue
- 3.5.30 qlc
- 3.5.31 re
- 3.5.32 random
- 3.5.33 rfc4627-json
- 3.5.34 string
- 3.5.35 ssh
- 3.5.36 soft
- 3.5.37 sets
- 3.5.38 supervisor
- 3.5.39 tuple
- 3.5.40 timer
- 3.5.41 unicode
- 3.5.42 cpu
- 3.5.43 math
- 3.5.44 zip
- 3.5.45 shell
- 3.6 SASL
- 3.7 asn1
- 3.8 compiler
- 3.9 tools
- 3.10 OS_Mon
- 3.11 crypto
- 3.12 Port
- 4.工具
- 4.1 Erlang预处理器
- 4.2 Erlang节点
- 4.3 Erlang多节点
- 4.3.1主从节点
- 4.4 Epmd
- 4.5 断点工具
- 4.6 dialyzer
- 4.7 dbg-debug 模块
- 4.7.1 dbg
- 4.8 Erlang跟踪工具
- 4.9 etop
- 4.10 profiling
- 4.10.1 fprof
- 4.10.2 eprof
- 4.10.3 cprof
- 5.进阶
- 5.1 TCP粘包、大小端
- 5.2 rebar发布系统
- 5.3 ErlangVM 心跳
- 5.4 Erlang GC
- 5.5 Erlang Time
- 5.6 Erlang 启动
- 5.6.1 SASL配置
- 5.7 Erlang系统限制
- 6.项目
- 6.1 the_seed
- 6.2 network
- 6.3 parse_tool
- 6.4 cache
- 7.项目研究
- 7.1 Mnesia
- 7.1.1 Mnesia模式
- 7.1.2 Mnesia操作
- 7.1.3 Mnesia增删改查
- 7.1.4 Mnesia过载分析
- 7.1.5 Mnesia高级特性
- 7.1.6 分布式
- 7.1.7 Mnesia表分片
- 7.1.8 Mnesia锁
- 7.1.9 dets
- 7.1.10 ets
- 7.2 Ejabberd
- 7.2.1 mod_echo.erl
- 7.2.2 hooks for module developers
- 7.2.3 Events list
- 7.3 cowboy
- 7.4 rebar
- 7.4.1 rebar Wiki
- 7.4.2 rebar.config.script
- 7.5 RIAK CS
- 7.6 Leofs
- 7.6.1 简介
- 8.资料整理
- 8.1 资料
- 8.1.1 Erlang的调度原理
- 8.1.2 虚拟机代码执行原理
- 8.1.3 SMP
- 8.2 杂记
- 8.2.1 设计