Search
 
SCRIPT & CODE EXAMPLE
 

ELIXIR

elixir string to time

defmodule SomeModule do
  @doc """
      iex> SomeModule.to_date("2020-01-30")
      ~D[2020-01-30]
  """
  def to_date(string), do: Date.from_iso8601!(string)

  @doc """
      iex> SomeModule.to_date_time("1997-07-16T19:20:30.45Z")
      ~U[1997-07-16 19:20:30.45Z]
  """
  def to_date_time(string) do
    case DateTime.from_iso8601(string) do
      {:ok, date_time, _offset} -> date_time
      error -> error
    end
  end
end
Comment

PREVIOUS NEXT
Code Example
Elixir :: elixir rescue 
Elixir :: elixir catch 
Elixir :: elixir ecto query to sql 
Elixir :: what is elixir language 
Elixir :: elixir read csv file 
Elixir :: elixir get_in access all 
Elixir :: elixir enum chunk_every 
Elixir :: elixir list 
Scala :: how to transform Nil to None scala 
Scala :: new scala project 
Scala :: scala jrtpath 
Scala :: get last index of list scala 
Actionscript :: dynamic computed property vue 
Excel :: google sheets select element after split 
Excel :: excel or function 
Perl :: perl until loop 
Perl :: perl format decimal 2 places not rounding 
Pascal :: pascal try catch finally 
Powershell :: powershell take ownership recursive command 
Gdscript :: godot find_node() 
Abap :: comments in abap 
Assembly :: sqlalchemy filter date today 
Assembly :: Z language latex 
Assembly :: list all sensors android 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: jquery remove required attribute 
Javascript :: react refresh page 
Javascript :: javascript void(0) href 
Javascript :: get tomorrows date using moment 
Javascript :: random number between 0 and 3 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =