3
0

date-works 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. dt=`busybox date -d 1:2`
  6. dt=`echo "$dt" | cut -b12-19`
  7. test x"$dt" = x"01:02:00"
  8. dt=`busybox date -d 1:2:3`
  9. dt=`echo "$dt" | cut -b12-19`
  10. test x"$dt" = x"01:02:03"
  11. dt=`busybox date -d 1.2-3:4`
  12. dt=`echo "$dt" | cut -b5-19`
  13. test x"$dt" = x"Jan 2 03:04:00"
  14. dt=`busybox date -d 1.2-3:4:5`
  15. dt=`echo "$dt" | cut -b5-19`
  16. test x"$dt" = x"Jan 2 03:04:05"
  17. dt=`busybox date -d 1999.1.2-3:4`
  18. dt=`echo "$dt" | cut -b1-19`
  19. test x"$dt" = x"Sat Jan 2 03:04:00"
  20. dt=`busybox date -d 1999.1.2-3:4:5`
  21. dt=`echo "$dt" | cut -b1-19`
  22. test x"$dt" = x"Sat Jan 2 03:04:05"
  23. dt=`busybox date -d '1999-1-2 3:4:5'`
  24. dt=`echo "$dt" | cut -b1-19`
  25. test x"$dt" = x"Sat Jan 2 03:04:05"
  26. dt=`busybox date -d 01231133`
  27. dt=`echo "$dt" | cut -b5-19`
  28. test x"$dt" = x"Jan 23 11:33:00"
  29. dt=`busybox date -d 200001231133`
  30. dt=`echo "$dt" | cut -b1-19`
  31. test x"$dt" = x"Sun Jan 23 11:33:00"
  32. dt=`busybox date -d 200001231133.30`
  33. dt=`echo "$dt" | cut -b1-19`
  34. test x"$dt" = x"Sun Jan 23 11:33:30"