How to convert a number of days into seconds in Linux?

Member

by gaston , in category: General Help , a month ago

How to convert a number of days into seconds in Linux?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by kaley , a month ago

@gaston 

To convert a number of days into seconds in Linux, you can use the date command. Here is an example:

  1. Open the terminal.
  2. Run the following command, replacing : echo "$(($(date -d "


For example, if you want to convert 5 days into seconds, you would run:

1
echo "$(($(date -d "5 days" +%s)))"


The command will output the number of seconds.