openmolecules.org

 
Home » DataWarrior » Functionality » Calculate number of dates between 2 dates
Calculate number of dates between 2 dates [message #1853] Tue, 21 February 2023 10:03 Go to next message
Zioubi is currently offline  Zioubi
Messages: 2
Registered: February 2023
Junior Member
Hello,
I would like to know if it is possible to calculate the number of days or weeks between two dates?
If yes how? And in general what is the general format for date?

Many thanks

Zioubi
Re: Calculate number of dates between 2 dates [message #1854 is a reply to message #1853] Tue, 21 February 2023 10:28 Go to previous messageGo to next message
thomas is currently offline  thomas
Messages: 715
Registered: June 2014
Senior Member
If you have a table with two date columns like the following

Date1 Date2
10-Jan-2020 10-Jan-2021
15-Jan-2020 18-Jan-2021
22-Jan-2020 10-Feb-2020

and use "Data->Add Calculated Values..." with formula "Date2-Date1", then you get a new column as:

Date1 Date2 Delta
10-Jan-2020 10-Jan-2021 366
15-Jan-2020 18-Jan-2021 369
22-Jan-2020 10-Feb-2020 19

DataWarrior has no defined date format. It uses a plausibility check whether a column is likely to contain date values. If a column contains three values in a consistent format, and if two values are in the range 1-31, 1-12 (or English three letter month abbreviations), and the third looks like a year, then a column is interpreted as date values.

Thomas
Re: Calculate number of dates between 2 dates [message #1855 is a reply to message #1854] Tue, 21 February 2023 10:46 Go to previous message
Zioubi is currently offline  Zioubi
Messages: 2
Registered: February 2023
Junior Member
Thanks Thomas
Previous Topic: List Membership Filter
Next Topic: histograms 2D view
Goto Forum:
  


Current Time: Thu Nov 21 22:37:28 CET 2024

Total time taken to generate the page: 0.03361 seconds