Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Simple method to find the number of seconds between two (non-standard) date formats?

Not sure what you mean by "without calculation". The following does the calculation...

date1="Thu Mar 5 09:15:27 2015"
date2="Thu Mar 5 09:30:58 2015"

printf "%s\n" $(( $(date -d "$date2" "+%s") - $(date -d "$date1" "+%s") ))

Tags:

Bash

Date

Related

Get names of devices on the network How do I explicitly and safely force the use of a built-in command in bash How to copy a file from a remote server to a local machine? Want to substitute only first occurence with sed How to print incremental count of occurrences of unique values in column 1 How can I get the current working directory? Completely buffer command output before piping to another command? Running a script during booting/startup; init.d vs cron @reboot Renaming the current directory from a shell - possible? Calculate date difference between Last modified date of a file and NOW using shell script How do I replace the last occurrence of a character in a string using sed? Recognizing GPT partition table created with different logical sector size

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy