1
我有一個Ecto.DateTime我試圖從中提取信息。使用to_erl將Ecto.DateTime轉換爲Erlang日期時間元組使用to_erl
這是工作的罰款:
{{y, m, d}, _} = Ecto.DateTime.to_erl(date)
"#{m}/#{d}/#{y}"
我想現在拿到小時/分/秒值:
{{y, m, d}, {h,m,s}} = Ecto.DateTime.to_erl(date)
"#{m}/#{d}/#{y}"
但我得到這個錯誤
沒有右手邊值匹配:{{2017,5,5},{12,0,0}}
D'哦!接得好! –
@SergioTapia請考慮標記幫助正確的答案。 – mudasobwa