我一直在做使用Calendar
一切日期時間的轉換是爲過去4個月工作正常,但所有的突然我開始在這一些奇怪的行爲, 什麼我做的是%Calendar.AmbiguousDateTime {possible_date_times日曆藥劑
1..total_days |> Enum.reduce(start_date, fn _i, acc ->
day_of_week = acc |> Calendar.Date.day_of_week_name
rec_head = get_head_tail(schedule[day_of_week])
rec_head |> Enum.each(fn(x) ->
iterate(x, acc, timezone) |> t_download(interval, t_agent)
end)
acc |> Calendar.DateTime.to_erl |> IO.inspect |> Calendar.DateTime.from_erl!(timezone, {123456, 6}) |> IO.inspect |> Calendar.DateTime.add!(86400)
end)
而且
acc |> Calendar.DateTime.to_erl |> IO.inspect |> Calendar.DateTime.from_erl!(timezone, {123456, 6}) |> IO.inspect |> Calendar.DateTime.add!(86400)
給輸出
{{2016, 10, 27}, {1, 0, 0}}
%Calendar.DateTime{abbr: "IST", day: 27, hour: 1, min: 0, month: 10, sec: 0,
std_off: 3600, timezone: "Europe/Dublin", usec: {123456, 6}, utc_off: 0,
year: 2016}
{{2016, 10, 28}, {1, 0, 0}}
%Calendar.DateTime{abbr: "IST", day: 28, hour: 1, min: 0, month: 10, sec: 0,
std_off: 3600, timezone: "Europe/Dublin", usec: {123456, 6}, utc_off: 0,
year: 2016}
{{2016, 10, 29}, {1, 0, 0}}
%Calendar.DateTime{abbr: "IST", day: 29, hour: 1, min: 0, month: 10, sec: 0,
std_off: 3600, timezone: "Europe/Dublin", usec: {123456, 6}, utc_off: 0,
year: 2016}
{{2016, 10, 30}, {1, 0, 0}}
但在最後的日期和時間,而不是給我的,因爲它是上面給出正確的輸出,這是給這個
{:ambiguous, %Calendar.AmbiguousDateTime{possible_date_times: [%Calendar.DateTime{abbr: "GMT", day: 30, hour: 1, min: 0, month: 10, sec: 0, std_off: 0, timezone: "Europe/Dublin", usec: {123456, 6}, utc_off: 0, year: 2016}, %Calendar.DateTime{abbr: "IST", day: 30, hour: 1, min: 0, month: 10, sec: 0, std_off: 3600, timezone: "Europe/Dublin", usec: {123456, 6}, utc_off: 0, year: 2016}]}}
我完全不知道的這個原因,因爲這是工作正常,但所有的突發其給我這些錯誤。任何幫助?
更新:正在使用https://github.com/lau/calendar日曆。
我假設你正在使用[lau/calendar](https://github.com/lau/calendar),可能值得在問題中指出。 – nietaki
謝謝你這樣做.. – ijunaidfarooq
@nietaki Btw剛剛看到你是來自MainFrame,我的X同事同事也在Mainframe,Milos Mosic .. – ijunaidfarooq