user1928543
user1928543

Reputation: 45

How to convert time in bash

I have variable (for example someDate) which hold time in format YYYY/MM/DD HH:MM:SS (for example 2017/06/26 00:00:00) and now I want to add to this variable +3 days.

But when I'm doing

newDate=$(date -d "$someDate + 3 days")

I get always only

Mon Jun 26 23:00:00 CEST 2017

Thanks for help

Upvotes: 1

Views: 136

Answers (1)

Aleksei Shestakov
Aleksei Shestakov

Reputation: 2538

Try to remove + from command, date -d "2017/06/26 00:00:00 3 days" worked well for me. Documentation

Upvotes: 4

Related Questions