blob: 901c485eccb82fdec8ae9cd13e698fbe88d8d47c [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
34dt=`busybox date -d 01231133`
Denis Vlasenko4809a9f2008-04-27 20:58:43 +000035dt=`echo "$dt" | cut -b5-19`
36test x"$dt" = x"Jan 23 11:33:00"
Denis Vlasenko4d89a8b2008-04-25 02:14:07 +000037
Denys Vlasenko941990f2009-07-18 04:54:21 +020038dt=`busybox date -d 200001231133`
Denis Vlasenko4d89a8b2008-04-25 02:14:07 +000039dt=`echo "$dt" | cut -b1-19`
40test x"$dt" = x"Sun Jan 23 11:33:00"
41
Denys Vlasenko941990f2009-07-18 04:54:21 +020042dt=`busybox date -d 200001231133.30`
Denis Vlasenko4d89a8b2008-04-25 02:14:07 +000043dt=`echo "$dt" | cut -b1-19`
44test x"$dt" = x"Sun Jan 23 11:33:30"