Denis Vlasenko | 4d89a8b | 2008-04-25 02:14:07 +0000 | [diff] [blame] | 1 | dt=`busybox date` |
| 2 | # Expected format: Fri Apr 25 03:47:55 CEST 2008 |
| 3 | dt=`echo "$dt" | sed 's/^[^ ][^ ][^ ] [^ ][^ ][^ ] [ 0123][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9] [A-Z][A-Z]* [012][0-9][0-9][0-9]$/OK/'` |
| 4 | test x"$dt" = x"OK" |
| 5 | |
| 6 | dt=`busybox date -d 1:2` |
Denis Vlasenko | 4809a9f | 2008-04-27 20:58:43 +0000 | [diff] [blame] | 7 | dt=`echo "$dt" | cut -b12-19` |
| 8 | test x"$dt" = x"01:02:00" |
Denis Vlasenko | 4d89a8b | 2008-04-25 02:14:07 +0000 | [diff] [blame] | 9 | |
| 10 | dt=`busybox date -d 1:2:3` |
Denis Vlasenko | 4809a9f | 2008-04-27 20:58:43 +0000 | [diff] [blame] | 11 | dt=`echo "$dt" | cut -b12-19` |
| 12 | test x"$dt" = x"01:02:03" |
Denis Vlasenko | 4d89a8b | 2008-04-25 02:14:07 +0000 | [diff] [blame] | 13 | |
| 14 | dt=`busybox date -d 1.2-3:4` |
Denis Vlasenko | 4809a9f | 2008-04-27 20:58:43 +0000 | [diff] [blame] | 15 | dt=`echo "$dt" | cut -b5-19` |
| 16 | test x"$dt" = x"Jan 2 03:04:00" |
Denis Vlasenko | 4d89a8b | 2008-04-25 02:14:07 +0000 | [diff] [blame] | 17 | |
| 18 | dt=`busybox date -d 1.2-3:4:5` |
Denis Vlasenko | 4809a9f | 2008-04-27 20:58:43 +0000 | [diff] [blame] | 19 | dt=`echo "$dt" | cut -b5-19` |
| 20 | test x"$dt" = x"Jan 2 03:04:05" |
Denis Vlasenko | 4d89a8b | 2008-04-25 02:14:07 +0000 | [diff] [blame] | 21 | |
| 22 | dt=`busybox date -d 1999.1.2-3:4` |
| 23 | dt=`echo "$dt" | cut -b1-19` |
| 24 | test x"$dt" = x"Sat Jan 2 03:04:00" |
| 25 | |
| 26 | dt=`busybox date -d 1999.1.2-3:4:5` |
| 27 | dt=`echo "$dt" | cut -b1-19` |
| 28 | test x"$dt" = x"Sat Jan 2 03:04:05" |
| 29 | |
| 30 | dt=`busybox date -d '1999-1-2 3:4:5'` |
| 31 | dt=`echo "$dt" | cut -b1-19` |
| 32 | test x"$dt" = x"Sat Jan 2 03:04:05" |
| 33 | |
Denys Vlasenko | 61be8e4 | 2013-12-31 18:57:39 +0100 | [diff] [blame] | 34 | # date (GNU coreutils) 8.17 doesn't accept 01231133 either: |
| 35 | # date: invalid date '01231133' |
| 36 | #dt=`busybox date -d 01231133` |
| 37 | #dt=`echo "$dt" | cut -b5-19` |
| 38 | #test x"$dt" = x"Jan 23 11:33:00" |
Denis Vlasenko | 4d89a8b | 2008-04-25 02:14:07 +0000 | [diff] [blame] | 39 | |
Denys Vlasenko | 941990f | 2009-07-18 04:54:21 +0200 | [diff] [blame] | 40 | dt=`busybox date -d 200001231133` |
Denis Vlasenko | 4d89a8b | 2008-04-25 02:14:07 +0000 | [diff] [blame] | 41 | dt=`echo "$dt" | cut -b1-19` |
| 42 | test x"$dt" = x"Sun Jan 23 11:33:00" |
| 43 | |
Denys Vlasenko | 941990f | 2009-07-18 04:54:21 +0200 | [diff] [blame] | 44 | dt=`busybox date -d 200001231133.30` |
Denis Vlasenko | 4d89a8b | 2008-04-25 02:14:07 +0000 | [diff] [blame] | 45 | dt=`echo "$dt" | cut -b1-19` |
| 46 | test x"$dt" = x"Sun Jan 23 11:33:30" |