Elixir語言中 NaiveDateTime.from_iso8601!
相關用法介紹如下。
用法:
from_iso8601!(string, calendar \\ Calendar.ISO)
@spec from_iso8601!(String.t(), Calendar.calendar()) :: t()
解析 ISO 8601:2019 說明的擴展“日期和時間”格式。
如果格式無效則引發。
例子
iex> NaiveDateTime.from_iso8601!("2015-01-23T23:50:07.123Z")
~N[2015-01-23 23:50:07.123]
iex> NaiveDateTime.from_iso8601!("2015-01-23T23:50:07,123Z")
~N[2015-01-23 23:50:07.123]
iex> NaiveDateTime.from_iso8601!("2015-01-23P23:50:07")
** (ArgumentError) cannot parse "2015-01-23P23:50:07" as naive datetime, reason: :invalid_format
相關用法
- Elixir NaiveDateTime.from_iso8601用法及代碼示例
- Elixir NaiveDateTime.from_gregorian_seconds用法及代碼示例
- Elixir NaiveDateTime.from_erl!用法及代碼示例
- Elixir NaiveDateTime.from_erl用法及代碼示例
- Elixir NaiveDateTime.utc_now用法及代碼示例
- Elixir NaiveDateTime.truncate用法及代碼示例
- Elixir NaiveDateTime.convert!用法及代碼示例
- Elixir NaiveDateTime.new!用法及代碼示例
- Elixir NaiveDateTime.to_erl用法及代碼示例
- Elixir NaiveDateTime.diff用法及代碼示例
- Elixir NaiveDateTime.to_iso8601用法及代碼示例
- Elixir NaiveDateTime.local_now用法及代碼示例
- Elixir NaiveDateTime.compare用法及代碼示例
- Elixir NaiveDateTime.to_string用法及代碼示例
- Elixir NaiveDateTime.new用法及代碼示例
- Elixir NaiveDateTime.convert用法及代碼示例
- Elixir NaiveDateTime.to_time用法及代碼示例
- Elixir NaiveDateTime.to_date用法及代碼示例
- Elixir NaiveDateTime.to_gregorian_seconds用法及代碼示例
- Elixir NaiveDateTime.add用法及代碼示例
- Elixir NaiveDateTime用法及代碼示例
- Elixir Node.ping用法及代碼示例
- Elixir Node.start用法及代碼示例
- Elixir StringIO.flush用法及代碼示例
- Elixir Calendar.ISO.date_to_string用法及代碼示例
注:本文由純淨天空篩選整理自elixir-lang.org大神的英文原創作品 NaiveDateTime.from_iso8601!(string, calendar \\ Calendar.ISO)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。