Created
October 27, 2016 19:10
-
-
Save talentdeficit/8c8130630999561796ee01a3f0cbb311 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(5)> dates = [DateTime.from_unix!(100000000), DateTime.from_unix!(100000)] [%DateTime{calendar: Calendar.ISO, day: 3, hour: 9, microsecond: {0, 0}, | |
minute: 46, month: 3, second: 40, std_offset: 0, time_zone: "Etc/UTC", | |
utc_offset: 0, year: 1973, zone_abbr: "UTC"}, | |
%DateTime{calendar: Calendar.ISO, day: 2, hour: 3, microsecond: {0, 0}, | |
minute: 46, month: 1, second: 40, std_offset: 0, time_zone: "Etc/UTC", | |
utc_offset: 0, year: 1970, zone_abbr: "UTC"}] | |
iex(6)> Enum.sort(dates) | |
[%DateTime{calendar: Calendar.ISO, day: 2, hour: 3, microsecond: {0, 0}, | |
minute: 46, month: 1, second: 40, std_offset: 0, time_zone: "Etc/UTC", | |
utc_offset: 0, year: 1970, zone_abbr: "UTC"}, | |
%DateTime{calendar: Calendar.ISO, day: 3, hour: 9, microsecond: {0, 0}, | |
minute: 46, month: 3, second: 40, std_offset: 0, time_zone: "Etc/UTC", | |
utc_offset: 0, year: 1973, zone_abbr: "UTC"}] | |
iex(7)> dates = [DateTime.from_unix!(100000000), DateTime.from_unix!(300000)] | |
[%DateTime{calendar: Calendar.ISO, day: 3, hour: 9, microsecond: {0, 0}, | |
minute: 46, month: 3, second: 40, std_offset: 0, time_zone: "Etc/UTC", | |
utc_offset: 0, year: 1973, zone_abbr: "UTC"}, | |
%DateTime{calendar: Calendar.ISO, day: 4, hour: 11, microsecond: {0, 0}, | |
minute: 20, month: 1, second: 0, std_offset: 0, time_zone: "Etc/UTC", | |
utc_offset: 0, year: 1970, zone_abbr: "UTC"}] | |
iex(8)> Enum.sort(dates) | |
[%DateTime{calendar: Calendar.ISO, day: 3, hour: 9, microsecond: {0, 0}, | |
minute: 46, month: 3, second: 40, std_offset: 0, time_zone: "Etc/UTC", | |
utc_offset: 0, year: 1973, zone_abbr: "UTC"}, | |
%DateTime{calendar: Calendar.ISO, day: 4, hour: 11, microsecond: {0, 0}, | |
minute: 20, month: 1, second: 0, std_offset: 0, time_zone: "Etc/UTC", | |
utc_offset: 0, year: 1970, zone_abbr: "UTC"}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment