diff options
| author | Luis de Bethencourt <luis@debethencourt.com> | 2013-10-01 22:20:46 -0400 |
|---|---|---|
| committer | Luis de Bethencourt <luis@debethencourt.com> | 2013-10-01 22:20:46 -0400 |
| commit | c463772ebdbfca65017ac1bc2c8322d229b291a9 (patch) | |
| tree | ebea7c818e964a5aa6e57ad35e6a7a9b05f256ee /src/libextra | |
| parent | c8cdabc32fc7c6a5c3b01ef24340bc2f4b1ae359 (diff) | |
| download | rust-c463772ebdbfca65017ac1bc2c8322d229b291a9.tar.gz rust-c463772ebdbfca65017ac1bc2c8322d229b291a9.zip | |
extra: %U support in time::strftime
Fixes #2350
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/time.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libextra/time.rs b/src/libextra/time.rs index 7f08fcd908a..34b50588ae2 100644 --- a/src/libextra/time.rs +++ b/src/libextra/time.rs @@ -855,7 +855,7 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str { parse_type('S', tm)) } 't' => ~"\t", - //'U' {} + 'U' => format!("{:02d}", (tm.tm_yday - tm.tm_wday + 7) / 7), 'u' => { let i = tm.tm_wday as int; (if i == 0 { 7 } else { i }).to_str() @@ -1240,7 +1240,7 @@ mod tests { assert_eq!(local.strftime("%s"), ~"1234567890"); assert_eq!(local.strftime("%T"), ~"15:31:30"); assert_eq!(local.strftime("%t"), ~"\t"); - // assert!(local.strftime("%U") == "06"); + assert_eq!(local.strftime("%U"), ~"06"); assert_eq!(local.strftime("%u"), ~"5"); // assert!(local.strftime("%V") == "07"); assert_eq!(local.strftime("%v"), ~"13-Feb-2009"); |
