blob: 35c24686c13e147dfb73f71e54edbfe0db5e886f [file] [log] [blame]
Denis Vlasenko4d89a8b2008-04-25 02:14:07 +00001dt=`busybox date`
2# Expected format: Fri Apr 25 03:47:55 CEST 2008
3dt=`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/'`
4test x"$dt" = x"OK"
5
6dt=`busybox date -d 1:2`
Denis Vlasenko4809a9f2008-04-27 20:58:43 +00007dt=`echo "$dt" | cut -b12-19`
8test x"$dt" = x"01:02:00"
Denis Vlasenko4d89a8b2008-04-25 02:14:07 +00009
10dt=`busybox date -d 1:2:3`
Denis Vlasenko4809a9f2008-04-27 20:58:43 +000011dt=`echo "$dt" | cut -b12-19`
12test x"$dt" = x"01:02:03"
Denis Vlasenko4d89a8b2008-04-25 02:14:07 +000013
14dt=`busybox date -d 1.2-3:4`
Denis Vlasenko4809a9f2008-04-27 20:58:43 +000015dt=`echo "$dt" | cut -b5-19`
16test x"$dt" = x"Jan 2 03:04:00"
Denis Vlasenko4d89a8b2008-04-25 02:14:07 +000017
18dt=`busybox date -d 1.2-3:4:5`
Denis Vlasenko4809a9f2008-04-27 20:58:43 +000019dt=`echo "$dt" | cut -b5-19`
20test x"$dt" = x"Jan 2 03:04:05"
Denis Vlasenko4d89a8b2008-04-25 02:14:07 +000021
22dt=`busybox date -d 1999.1.2-3:4`
23dt=`echo "$dt" | cut -b1-19`
24test x"$dt" = x"Sat Jan 2 03:04:00"
25
26dt=`busybox date -d 1999.1.2-3:4:5`
27dt=`echo "$dt" | cut -b1-19`
28test x"$dt" = x"Sat Jan 2 03:04:05"
29
30dt=`busybox date -d '1999-1-2 3:4:5'`
31dt=`echo "$dt" | cut -b1-19`
32test x"$dt" = x"Sat Jan 2 03:04:05"
33
Denys Vlasenko61be8e42013-12-31 18:57:39 +010034# 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 Vlasenko4d89a8b2008-04-25 02:14:07 +000039
Denys Vlasenko941990f2009-07-18 04:54:21 +020040dt=`busybox date -d 200001231133`
Denis Vlasenko4d89a8b2008-04-25 02:14:07 +000041dt=`echo "$dt" | cut -b1-19`
42test x"$dt" = x"Sun Jan 23 11:33:00"
43
Denys Vlasenko941990f2009-07-18 04:54:21 +020044dt=`busybox date -d 200001231133.30`
Denis Vlasenko4d89a8b2008-04-25 02:14:07 +000045dt=`echo "$dt" | cut -b1-19`
46test x"$dt" = x"Sun Jan 23 11:33:30"