I try to convert a Debian Timestamp to a date in Android shell (Tasker) like:

date -d @1487411077

But getting some errors.

How to do that?

The Tasker error looks like:

12.32.45/Variables doreplresult: |sh date -d @%last| -> |sh date -d @1487411077
12.32.45/Variables doreplresult: |sh date -d @%last| -> |sh date -d @1487411077
12.32.45/E Shell Ausführen: %last -> %last
12.32.45/E Shell Ausführen:  -> 
12.32.45/E Shell Ausführen:  -> 
12.32.45/Shell runBackground sh date -d @1487411077
 root: true timeout: -1
12.32.45/Shell start process-thread ID 1013
12.32.45/E add wait type Shell1 time 2147483647
12.32.45/E add wait type Shell1 done
12.32.45/E add wait task
12.32.45/Variables doreplresult: |%last| -> |%last|
12.32.45/E Fehler: 127


Android date is busybox and the I have to use busybox date -d @1487411077

  • Add error messages to quesion – ctrl-alt-delor Feb 18 '17 at 11:36
  • I have edit my question. I use Tasker so I only can give you the Tasker error output! – fteinz Feb 18 '17 at 11:40
  • What happens if you run other commands? Do some experiments; You may find the problem is with tasker (not with date). – ctrl-alt-delor Feb 18 '17 at 11:44
  • I have not used tasker (or know what it is), or read German. However I thing that the message says there is something wrong with %last. What happens if you put in a literal as in you question, as opposed to the variable. – ctrl-alt-delor Feb 18 '17 at 11:46

As Android's date is busybox date, you should be able to do:

date -D%s -d 1487411077

-D was added in 2006, while support for -d@<epoch> à la GNU was added in 2010.

  • busybox date -d @1487411077 gives Sat Feb 18 09:44:37 GMT 2017. – ctrl-alt-delor Feb 18 '17 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.