Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on January 27, 2012, 06:54:30 AM

Title: Time span between two dates
Post by: jeanfabre on January 27, 2012, 06:54:30 AM
Hi,

 Here is a convenient Action to measure the time span between two dates.

You can get it on the ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)

or download it here:

GetTimeSpanBetweenDates (https://github.com/jeanfabre/PlayMakerCustomActions_U3/blob/e6d36a6fea9d9d5b7be07c411ef8aa8065fe5f73/Assets/PlayMaker%20Custom%20Actions/Time/GetTimeSpanBetweenDates.cs)

Bye,

 Jean
Title: Re: Time span between two dates
Post by: Loganou974 on July 24, 2013, 01:04:24 PM
Thank you A LOT !!! I mean it !
Title: Re: Time span between two dates
Post by: jess84 on March 25, 2014, 08:17:34 PM
Hi Jean,

Would it be an easy modification to get an action to do the following?

User enters their Start Date
Selects the Span
*Inputs a value*
Save output as string

So this calculates a future Date/Time based on the Start Date and the other user entered information.

This would be really handy for time limited in-game events and such if I could just store the current time, and then use an action to give me a new string for Start Date + 60minutes, etc.   :)
Title: Re: Time span between two dates
Post by: jeanfabre on April 02, 2014, 08:59:35 AM
Hi,

There you go, it's a bit convuluted, because of the timespan formating, so make sure you read this first:

http://msdn.microsoft.com/en-us/library/se73z7b9(v=vs.110).aspx

 typically,
-- putting "1" will add one day
-- putting "1.02:03" will add one day, 2 hours, and 3 seconds
-- putting "0.01" will add one hour.

Bye,

 Jean
Title: Re: Time span between two dates
Post by: jess84 on April 02, 2014, 11:42:42 AM
Wow, that's awesome. Thanks so much!!
Title: Re: Time span between two dates
Post by: TBrayner on April 11, 2014, 05:37:31 PM
Very cool, tks!
Title: Re: Time span between two dates
Post by: 10high on April 08, 2017, 12:31:35 PM
Hi,

I have a start date of 2/15/2015 and an end date of 3/17/2017 but I get a span of 30 days.

"Get span info" is set to "total days", but I get the same result for "days" (not sure what the difference between these is, TBH).

By my calculation it should be 32 days (if not including the start and end date). What am I missing here?

I hope someone can help me.

Thanks.
Title: Re: Time span between two dates
Post by: jeanfabre on April 10, 2017, 01:42:08 AM
Hi,

 First, these are not the same year, but I guess you mean 2017 right? I also count 30 days,

https://www.timeanddate.com/date/durationresult.html?d1=15&m1=02&y1=2017&d2=17&m2=03&y2=2017

and so is 2015 for the same range:

https://www.timeanddate.com/date/durationresult.html?d1=15&m1=2&y1=2015&d2=17&m2=3&y2=2015

How do you count 32 days?


also totaldays is a fractional, and days is only whole days:

http://stackoverflow.com/questions/25212667/what-is-the-diffrence-beetween-days-and-totaldays

Bye,

 Jean
Title: Re: Time span between two dates
Post by: 10high on April 12, 2017, 12:00:57 PM
OK, now I feel ashamed. Sorry for wasting your time and thank you for taking it to reply to such a stupid question. I guess my brain was a little fried.

I can't believe THIS was my first question.

Thanks again, and great product by the way.
Title: Re: Time span between two dates
Post by: jeanfabre on April 12, 2017, 02:22:19 PM
Hi,

 Don't worry, no one is judging :) It's actually very important to ask, even if after the solution looks simple, because it's only like that progress can be made, else you are stuck.

 Bye,

 Jean
Title: Re: Time span between two dates
Post by: LordHorusNL on April 13, 2017, 09:26:16 AM
Ohh nice this will come in handy.

Nice work jean
Title: Re: Time span between two dates
Post by: dudebxl on April 27, 2017, 03:18:03 AM
Also have Epoch actions in the ecosystem which might be useful...