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 Commented Mar 29, 2023 at 20:52
  • Just 2022-04-10 12:12:12
    – Timestamp
    Commented Mar 29, 2023 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? Commented Mar 29, 2023 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. Commented Mar 31, 2023 at 1:14
  • @GillesQuénot done
    – Timestamp
    Commented Apr 2, 2023 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
    Commented Apr 2, 2023 at 13:58

You must log in to answer this question.

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