0

i have this date output from aws cli "2020-08-13T12:30:00+00:00".

I need to convert this string to unixtimestamp and the perform some calculation in shell script. if calculation is true then add +1day to this output in same format ex ("2020-08-14T12:30:00+00:00"), else keep the same as it is.

How to convert "2020-08-13T12:30:00+00:00" to unixtimestamp and how to add +1 day in "2020-08-13T12:30:00+00:00"

0

1 Answer 1

1

How to convert "2020-08-13T12:30:00+00:00" to unixtimestamp

date --date '2020-08-13T12:30:00+00:00' +%s 

how to add +1 day in "2020-08-13T12:30:00+00:00"

date --date '2020-08-13T12:30:00+00:00 + 1 day' 
Sign up to request clarification or add additional context in comments.

2 Comments

When I answered a bash question with duplicates I got massive downvotes (even though the duplicate question was not raised when I posted). This is obviously a duplicate, so be prepared.
this is not working for me: ``` date --date '2020-08-13T12:30:00+00:00' +%s date: invalid date 2020-08-13T12:30:00+00:00' date --date '2020-08-13T12:30:00+00:00 + 1 day' date: invalid date 2020-08-13T12:30:00+00:00 + 1 day' ```

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.