0

When I tried to set time with

$(date +%s -d "2022-04-10 12:12:12")

I get the time

2022-04-10 19:12:12

How can I set the time explicit?

5
  • Thanks to add expected output. I get 1649567532 Mar 29 at 20:52
  • Just 2022-04-10 12:12:12
    – Timestamp
    Mar 29 at 20:52
  • 2
    If you ran the command you say you ran you would have received the error message, 1649589132: command not found. What did you actually run?
    – roaima
    Mar 29 at 21:31
  • Advice to newcomers: If an answer solves your problem, please accept it by clicking the large check mark (✓) next to it and optionally also up-vote it (up-voting requires at least 15 reputation points). If you found other answers helpful, please up-vote them. Accepting and up-voting helps future readers. Mar 31 at 1:14
  • @GillesQuénot done
    – Timestamp
    Apr 2 at 13:58

1 Answer 1

0

Like this:

date '+%F %T' -d "2022-04-10 12:12:12"
2022-04-10 12:12:12

Check:

man 3 strftime
1
  • Thanks.........
    – Timestamp
    Apr 2 at 13:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .