0.2.8: language changes.

- Slice patterns are now feature gated.

- Reformatted the `chrono::format::strftime` documentation
  with a proper table (closes #31).
This commit is contained in:
Kang Seonghoon 2015-03-30 10:19:41 +09:00
parent c43479bfa7
commit e012702033
5 changed files with 88 additions and 85 deletions

View File

@ -5,6 +5,7 @@ Colin Ray <r.colinray@gmail.com>
Dan <dan@ebip.co.uk>
David Ross <daboross@daboross.net>
Eunchong Yu <kroisse@gmail.com>
Huon Wilson <dbau.pp+github@gmail.com>
John Nagle <nagle@sitetruth.com>
Ken Tossell <ken@tossell.net>
Steve Klabnik <steve@steveklabnik.com>

View File

@ -1,6 +1,6 @@
[package]
name = "chrono"
version = "0.2.7"
version = "0.2.8"
authors = ["Kang Seonghoon <public+rust@mearie.org>"]
description = "Date and time library for Rust"
@ -15,5 +15,5 @@ license = "MIT/Apache-2.0"
name = "chrono"
[dependencies]
time = "0.1.21"
time = "0.1.22"

View File

@ -1,4 +1,4 @@
[Chrono][doc] 0.2.7
[Chrono][doc] 0.2.8
===================
[![Chrono on Travis CI][travis-image]][travis]

View File

@ -9,95 +9,97 @@
The following specifiers are available both to formatting and parsing.
```plain
Spec. Example Description
----- ------- -----------
Spec. | Example | Description
----- | ------------- | -----------
| | **DATE SPECIFIERS:**
`%Y` | `2001` | The full proleptic Gregorian year, zero-padded to 4 digits. [1]
`%C` | `20` | The proleptic Gregorian year divided by 100, zero-padded to 2 digits. [2]
`%y` | `01` | The proleptic Gregorian year modulo 100, zero-padded to 2 digits. [2]
| |
`%m` | `07` | Month number (01--12), zero-padded to 2 digits.
`%b` | `Jul` | Abbreviated month name. Always 3 letters.
`%B` | `July` | Full month name. Also accepts corresponding abbreviation in parsing.
`%h` | `Jul` | Same to `%b`.
| |
`%d` | `08` | Day number (01--31), zero-padded to 2 digits.
`%e` | ` 8` | Same to `%d` but space-padded.
| |
`%a` | `Sun` | Abbreviated weekday name. Always 3 letters.
`%A` | `Sunday` | Full weekday name. Also accepts corresponding abbreviation in parsing.
`%w` | `0` | Sunday = 0, Monday = 1, ..., Saturday = 6.
`%u` | `7` | Monday = 1, Tuesday = 2, ..., Sunday = 7. (ISO 8601)
| |
`%U` | `28` | Week number starting with Sunday (00--53), zero-padded to 2 digits. [3]
`%W` | `27` | Same to `%U`, but week 1 starts with the first Monday in that year instead.
| |
`%G` | `2001` | Same to `%Y` but uses the year number in ISO 8601 week date. [4]
`%g` | `01` | Same to `%y` but uses the year number in ISO 8601 week date. [4]
`%V` | `27` | Same to `%U` but uses the week number in ISO 8601 week date (01--53). [4]
| |
`%j` | `189` | Day of the year (001--366), zero-padded to 3 digits.
| |
`%D` | `08/07/2001` | Month-day-year format. Same to `%m/%d/%Y`.
`%x` | `08/07/2001` | Same to `%D`.
`%F` | `2001-07-08` | Year-month-day format (ISO 8601). Same to `%Y-%m-%d`.
`%v` | ` 7-Jul-2001` | Day-month-year format. Same to `%e-%b-%Y`.
| |
| | **TIME SPECIFIERS:**
`%H` | `00` | Hour number (00--23), zero-padded to 2 digits.
`%k` | ` 0` | Same to `%H` but space-padded.
`%I` | `12` | Hour number in 12-hour clocks (01--12), zero-padded to 2 digits.
`%l` | `12` | Same to `%I` but space-padded.
| |
`%P` | `am` | `am` or `pm` in 12-hour clocks.
`%p` | `AM` | `AM` or `PM` in 12-hour clocks.
| |
`%M` | `34` | Minute number (00--59), zero-padded to 2 digits.
`%S` | `60` | Second number (00--60), zero-padded to 2 digits. [5]
`%f` | `026413966` | The number of nanoseconds since last whole second, zero-padded to 9 digits.
| |
`%R` | `00:34` | Hour-minute format. Same to `%H:%M`.
`%T` | `00:34:60` | Hour-minute-second format. Same to `%H:%M:%S`.
`%x` | `00:34:60` | Same to `%T`.
`%r` | `12:34:60 AM` | Hour-minute-second format in 12-hour clocks. Same to `%I:%M:%S %p`.
| |
| | **TIME ZONE SPECIFIERS:**
`%Z` | `ACST` | Local time zone name.
`%z` | `+09:30` | Offset from the local time to UTC (with UTC being `+00:00`).
| |
| | **DATE & TIME SPECIFIERS:**
`%c` | `Sun Jul 8 00:34:60 2001` | `ctime` date & time format. Same to `%a %b %e %T %Y` sans `\n`.
`%+` | `2001-07-08T00:34:60+09:30` | ISO 8601 date & time format. Close to `%Y-%m-%dT%H:%M:%S%z`.
| |
`%s` | `994485899` | UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. [6]
| |
| | **SPECIAL SPECIFIERS:**
`%t` | | Literal tab (`\t`).
`%n` | | Literal newline (`\n`).
`%%` | | Literal percent sign.
DATE SPECIFIERS:
Notes:
%Y 2001 The full proleptic Gregorian year, zero-padded to 4 digits.
1. `%Y`:
Negative years are allowed in formatting but not in parsing.
%C 20 The proleptic Gregorian year divided by 100, zero-padded to 2 digits.
This is floor division, so 100 BCE (year number -99) will print `-1`.
%y 01 The proleptic Gregorian year modulo 100, zero-padded to 2 digits.
This is floor division, so 100 BCE (year number -99) will print `99`.
%m 07 Month number (01--12), zero-padded to 2 digits.
%b Jul Abbreviated month name. Always 3 letters.
%B July Full month name. Also accepts corresponding abbreviation in parsing.
%h Jul Same to `%b`.
2. `%C`, `%y`:
This is floor division, so 100 BCE (year number -99) will print `-1` and `99` respectively.
%d 08 Day number (01--31), zero-padded to 2 digits.
%e 8 Same to `%d` but space-padded.
%a Sun Abbreviated weekday name. Always 3 letters.
%A Sunday Full weekday name. Also accepts corresponding abbreviation in parsing.
%w 0 Sunday = 0, Monday = 1, ..., Saturday = 6.
%u 7 Monday = 1, Tuesday = 2, ..., Sunday = 7. (ISO 8601)
%U 28 Week number (00--53), zero-padded to 2 digits.
3. `%U`:
Week 1 starts with the first Sunday in that year.
It is possible to have week 0 for days before the first Sunday.
%W 27 Same to `%U`, but week 1 starts with the first Monday in that year.
%G 2001 Same to `%Y` but uses the year number in ISO 8601 week date.
%g 01 Same to `%y` but uses the year number in ISO 8601 week date.
%V 27 Same to `%U` but uses the week number in ISO 8601 week date (01--53).
4. `%G`, `%g`, `%V`:
Week 1 is the first week with at least 4 days in that year.
Week 0 does not exist, so this should be used with `%G` or `%g`.
%j 189 Day of the year (001--366), zero-padded to 3 digits.
%D 08/07/2001 Month-day-year format. Same to `%m/%d/%Y`.
%x 08/07/2001 Same to `%D`.
%F 2001-07-08 Year-month-day format (ISO 8601). Same to `%Y-%m-%d`.
%v 7-Jul-2001 Day-month-year format. Same to `%e-%b-%Y`.
TIME SPECIFIERS:
%H 00 Hour number (00--23), zero-padded to 2 digits.
%k 0 Same to `%H` but space-padded.
%I 12 Hour number in 12-hour clocks (01--12), zero-padded to 2 digits.
%l 12 Same to `%I` but space-padded.
%P am `am` or `pm` in 12-hour clocks.
%p AM `AM` or `PM` in 12-hour clocks.
%M 34 Minute number (00--59), zero-padded to 2 digits.
%S 60 Second number (00--60), zero-padded to 2 digits.
5. `%S`:
It accounts for leap seconds, so `60` is possible.
%f 026413966 The number of nanoseconds since the last whole second,
zero-padded to 9 digits.
%R 00:34 Hour-minute format. Same to `%H:%M`.
%T 00:34:60 Hour-minute-second format. Same to `%H:%M:%S`.
%x 00:34:60 Same to `%T`.
%r 12:34:60 AM Hour-minute-second format in 12-hour clocks. Same to `%I:%M:%S %p`.
TIME ZONE SPECIFIERS:
%Z ACST Local time zone name.
%z +09:30 Offset from the local time to UTC (with UTC being `+00:00`).
DATE & TIME SPECIFIERS:
%c Sun Jul 8 00:34:60 2001
`ctime` date & time format. Same to `%a %b %e %T %Y`. (No newline!)
%+ 2001-07-08T00:34:60+09:30
ISO 8601 date & time format. Almost same to `%Y-%m-%dT%H:%M:%S%z`.
%s 994485899 UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC.
6. `%s`:
This is not padded and can be negative.
For the purpose of Chrono, it only accounts for non-leap seconds
so it slightly differs from ISO C `strftime` behavior.
SPECIAL SPECIFIERS:
%t Literal tab (`\t`).
%n Literal newline (`\n`).
%% Literal percent sign.
```
*/
use super::{Item, Numeric, Fixed, Pad};

View File

@ -4,7 +4,7 @@
/*!
# Chrono 0.2.7
# Chrono 0.2.8
Date and time handling for Rust. (also known as `rust-chrono`)
It aims to be a feature-complete superset of the [time](https://github.com/rust-lang/time) library.