Construct date for specific day of current month and convert it to epoch

36 views Asked by At

I need epoch of 4th day of current month.

I have this:

START_DT=$(date +"%Y-%m-04 00:00:00")
START_DT_TS=$(date -d "$START_DT" +%s)

Output is 1433368800 which is expected.

How I achieve this on single line?

1

There are 1 answers

0
Pavel Sedek On BEST ANSWER

Try backqoutes approach

date -d "`date +\"%Y-%m-04 00:00:00\"`" +%s