The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Calculate time interval in months
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Clairekun

Germany
175 Posts

Posted - 03/04/2021 :  09:12:13 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Originpro 2018b
Operating System: Windows 10

Hello,

I have been unable to find a similar existing topic, so please forgive me if there already is one. I have a table with date values and need to calculate time intervals between each of those values and a specific day.

I have been able to get this interval in days (considering Origin reads dates as Julina dates) by setting column values as:

Col(A)-RefDate

Before Formula scripts: RefDate = date(25/05/2019,2)


However, I would need to transform those values to months, taking into account that there can be 28, 30 or 31 days in a month (leap years not necessary).

Is this achievable in any way? I assume I could define a range of conditional variables depending on the month (might need help with this), but if there was a more automatic method, it would be great. As I understand, time formats cannot be set as monthly, and date formats don't work here.

Thank you.

snowli

USA
1379 Posts

Posted - 03/04/2021 :  09:26:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Could you explain how you want to calculate the interval in month?

E.g. if 3/1/2021 in col(A), while 2/28/2021 is refdate, should time interval be 1 month of 0 month?

In Set Column Values dialog, click Function: Date: menu, there are many date related functions.
E.g. u can use month() to get the month of the date, e.g. month(3/1/2021) will return 3.
U can use month(A)-month(refdate) to get month interval.

Best,
Snow
Go to Top of Page

Clairekun

Germany
175 Posts

Posted - 03/04/2021 :  09:36:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli


E.g. if 3/1/2021 in col(A), while 2/28/2021 is refdate, should time interval be 1 month of 0 month?


It would be 0/28 months in february + 1/31 months in march, meaning a total of 0.03 months.

I'll look into date related functions, although I couldn't find anything when I first skim read it.
Go to Top of Page

snowli

USA
1379 Posts

Posted - 03/04/2021 :  10:27:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Your user story isn't clear. Could you explain more on this so we can see if we need to add function for this.


BTW, from 3/1/2021 to 2/28/2021, it's 1 day interval but it seems you are treating it as 2 days interval.

Best,
Snow
Go to Top of Page

Clairekun

Germany
175 Posts

Posted - 03/04/2021 :  11:25:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Your user story isn't clear.

I'm sorry about that, I have worked with many different types of data/techniques over time, I guess it can be confusing.
quote:
Could you explain more on this so we can see if we need to add function for this.

There is a reference table with expected results over time, in months.

I measure my data every few days, and plot it against the expected results to compare, using the first day of measurement as zero. Ideally, I would use the same scale.

Either way, I don't believe it is such a necessary function to add to the software; since the data is measured in a large period of time, I realised such precission is not really needed; asuming months are 365/12 days long is a good approximation.

Edited by - Clairekun on 03/04/2021 11:26:14 AM
Go to Top of Page

snowli

USA
1379 Posts

Posted - 03/04/2021 :  12:25:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
OK, thanks for clarifying it.

Best,
Snow
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000