forgot to update the docs for removal of `Time`...

This commit is contained in:
Kang Seonghoon 2015-02-19 05:42:18 +09:00
parent be6a721be6
commit e80501dcb3
2 changed files with 26 additions and 16 deletions

View File

@ -204,12 +204,11 @@ assert!(UTC.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T").is_err());
assert!(UTC.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err()); assert!(UTC.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err());
~~~~ ~~~~
### Individual date and time ### Individual date
Chrono also provides an individual date type (`Date`) and time type (`Time`). Chrono also provides an individual date type (`Date`).
They also have time zones attached, and have to be constructed via time zones. It also has time zones attached, and have to be constructed via time zones.
Most operations available to `DateTime` are also available to `Date` and `Time` Most operations available to `DateTime` are also available to `Date` whenever appropriate.
whenever appropriate.
~~~~ {.rust} ~~~~ {.rust}
use chrono::*; use chrono::*;
@ -223,18 +222,24 @@ assert_eq!(UTC.ymd(2014, 11, 28).and_hms_milli(7, 8, 9, 10).format("%H%M%S").to_
"070809"); "070809");
~~~~ ~~~~
`DateTime` has two methods, `date` and `time`, There is no timezone-aware `Time` due to the lack of usefulness and also the complexity.
which return narrow views to its date and time components respectively.
`DateTime` has `date` method which returns a narrow view to its date component.
There is also a `time` method, which simply returns a naive local time described below.
### Naive date and time ### Naive date and time
Chrono provides naive counterparts to `Date`, `Time` and `DateTime` Chrono provides naive counterparts to `Date`, (non-existent) `Time` and `DateTime`
as `NaiveDate`, `NaiveTime` and `NaiveDateTime` respectively. as `NaiveDate`, `NaiveTime` and `NaiveDateTime` respectively.
They have almost equivalent interfaces as their timezone-aware twins, They have almost equivalent interfaces as their timezone-aware twins,
but are not associated to time zones obviously and can be quite low-level. but are not associated to time zones obviously and can be quite low-level.
They are mostly useful for building blocks for higher-level types. They are mostly useful for building blocks for higher-level types.
Timezone-aware `DateTime` and `Date` types have two methods returning naive versions:
`naive_local` returns a view to the naive local time,
and `naive_utc` returns a view to the naive UTC time.
## Limitations ## Limitations
Only proleptic Gregorian calendar (i.e. extended to support older dates) is supported. Only proleptic Gregorian calendar (i.e. extended to support older dates) is supported.

View File

@ -205,12 +205,11 @@ assert!(UTC.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T").is_err());
assert!(UTC.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err()); assert!(UTC.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err());
~~~~ ~~~~
### Individual date and time ### Individual date
Chrono also provides an individual date type (`Date`) and time type (`Time`). Chrono also provides an individual date type (`Date`).
They also have time zones attached, and have to be constructed via time zones. It also has time zones attached, and have to be constructed via time zones.
Most operations available to `DateTime` are also available to `Date` and `Time` Most operations available to `DateTime` are also available to `Date` whenever appropriate.
whenever appropriate.
~~~~ {.rust} ~~~~ {.rust}
use chrono::*; use chrono::*;
@ -225,18 +224,24 @@ assert_eq!(UTC.ymd(2014, 11, 28).and_hms_milli(7, 8, 9, 10).format("%H%M%S").to_
"070809"); "070809");
~~~~ ~~~~
`DateTime` has two methods, `date` and `time`, There is no timezone-aware `Time` due to the lack of usefulness and also the complexity.
which return narrow views to its date and time components respectively.
`DateTime` has `date` method which returns a narrow view to its date component.
There is also a `time` method, which simply returns a naive local time described below.
### Naive date and time ### Naive date and time
Chrono provides naive counterparts to `Date`, `Time` and `DateTime` Chrono provides naive counterparts to `Date`, (non-existent) `Time` and `DateTime`
as `NaiveDate`, `NaiveTime` and `NaiveDateTime` respectively. as `NaiveDate`, `NaiveTime` and `NaiveDateTime` respectively.
They have almost equivalent interfaces as their timezone-aware twins, They have almost equivalent interfaces as their timezone-aware twins,
but are not associated to time zones obviously and can be quite low-level. but are not associated to time zones obviously and can be quite low-level.
They are mostly useful for building blocks for higher-level types. They are mostly useful for building blocks for higher-level types.
Timezone-aware `DateTime` and `Date` types have two methods returning naive versions:
`naive_local` returns a view to the naive local time,
and `naive_utc` returns a view to the naive UTC time.
## Limitations ## Limitations
Only proleptic Gregorian calendar (i.e. extended to support older dates) is supported. Only proleptic Gregorian calendar (i.e. extended to support older dates) is supported.