You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+11-11
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ To use timex with your projects, edit your mix.exs file and add it as a dependen
9
9
10
10
```elixir
11
11
defpdepsdo
12
-
[{:timex, "~> 0.13.4"}]
12
+
[{:timex, "~> 0.14.0"}]
13
13
end
14
14
```
15
15
@@ -19,7 +19,7 @@ To use Timex modules without the Timex namespace, add `use Timex` to the top of
19
19
20
20
The goal of this project is to provide a complete set of Date/Time functionality for Elixir projects, with the hope of being eventually merged into the standard library.
21
21
22
-
The `Date` module is for dealing with dates, which includes time and timezone information for those dates. It supports getting current date in any time zone, converting between timezones while taking Daylight Savings Time offsets into account, calculating time intervals between two dates, shifting a date by some amount of seconds/hours/days/years towards past and future, etc. As Erlang provides support only for the Gregorian calendar, that's what timex currently supports, but it is possible to add additional calendars if needed.
22
+
The `Date` module is for dealing with dates, which includes time and timezone information for those dates. It supports getting current date in any time zone, converting between timezones while taking zone offset changes into account, calculating time intervals between two dates, shifting a date by some amount of seconds/hours/days/years towards past and future, etc. As Erlang provides support only for the Gregorian calendar, that's what timex currently supports, but it is possible to add additional calendars if needed.
23
23
24
24
The `Time` module supports a finer grained level of arithmetic over time intervals. It is intended for use as timestamps in logs, measuring code execution times, converting time units, etc.
25
25
@@ -44,7 +44,7 @@ Since Erlang's native date format doesn't carry any time zone information, `Date
44
44
```elixir
45
45
datetime = {{2013,3,17},{21,22,23}}
46
46
47
-
date =Date.from(datetime) # datetime is assumed to be in UTC by default
47
+
date =Date.from(datetime) # datetime is assumed to be in UTC by default
48
48
DateFormat.format!(date, "{RFC1123}") #=> "Sun, 17 Mar 2013 21:22:23 GMT"
49
49
50
50
date =Date.from(datetime, "CST") # With a provided timezone
@@ -56,7 +56,11 @@ Date.local(date) # convert date to local time zone (CST for our example)
@@ -198,13 +200,11 @@ Parsing dates is also a breeze with `DateFormat`:
198
200
199
201
```elixir
200
202
# Parse a date using the default parser
201
-
gmt =Date.timezone("GMT")
202
-
date =Date.from({{2013,3,5},{23,25,19}}, gmt)
203
+
date =Date.from({{2013,3,5},{23,25,19}}, "GMT")
203
204
{:ok, ^date} =DateFormat.parse("Tue, 05 Mar 2013 23:25:19 GMT", "{RFC1123}")
204
205
205
206
# Any preformatted directive ending in `z` will shift the date to UTC/Zulu
206
-
gmt =Date.timezone("EET")
207
-
date =Date.from({{2013,3,5},{23,25,19}})
207
+
date =Date.from({{2013,3,5},{23,25,19}}, "Europe/Athens")
208
208
{:ok, ^date} =DateFormat.parse("Tue, 05 Mar 2013 23:25:19 +0200", "{RFC1123z}")
209
209
210
210
# Simple date format, default parser
@@ -331,7 +331,7 @@ Use `Date.diff` to obtain the number of seconds, minutes, hours, days, months, w
331
331
332
332
Full support for retreiving local timezone configuration on OSX, *NIX, and Windows, conversion to any timezone in the Olson timezone database, and full support for daylight savings time transitions.
333
333
334
-
Timezone support is also exposed via the `Timezone`, `Timezone.Local`, and `Timezone.Dst` modules. Their functionality is exposed via the `Date` module's API, and most common use cases shouldn't need to access the `Timezone` namespace directly, but it's there if needed.
334
+
Timezone support is also exposed via the `Timezone`, `Timezone.Local` modules. Their functionality is exposed via the `Date` module's API, and most common use cases shouldn't need to access the `Timezone` namespace directly, but it's there if needed.
0 commit comments