我有一個日期。使之成爲該格式的通過時間我如何格式化:使用Timex格式化日期時間
Wed, 02 Oct 2002 15:00:00 +0200
或
Wed, 02 Oct 2002 15:00:00 GMT
或
Wed, 02 Oct 2002 15:00:00 EST
我已經試過這樣:
Timex.format!(my_date, "%D, %d %M %Y %H:%i:%s T", :strftime))
但它拋出了一個例外:
%Timex.Format.FormatError{message: {:format, "Expected end of input at line 1, column 16"}} (expected a string)
雖然它正在轉換爲其他更簡單的格式,沒有錯誤。
這格式字符串中有多處錯誤。 '%D'不是星期幾,時區是'%Z'(或'%z'或其他,但不是'T')。請參閱https://hexdocs.pm/timex/Timex.Format.DateTime.Formatters.Strftime.html。 – Dogbert