Timeline for Date Time - Seconds Difference
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 3, 2018 at 19:24 | comment | added | Sezen | For the @jerry-coffin 's answer, if your date is not correct, i.e., for a date 2010-02-29 12:00:00, it will assume date as 2010-03-01 12:00:00. If you are not sure your dates are exactly correct, this method will fail. Be cautious! | |
Dec 31, 2011 at 23:28 | vote | accept | hiddensunset4 | ||
Nov 29, 2011 at 1:05 | comment | added | hiddensunset4 | Thanks a tonne mate, this is definitely the best solution. Regression tests show 100% accuracy for the time periods I am using. | |
Nov 28, 2011 at 22:27 | history | edited | Jerry Coffin | CC BY-SA 3.0 |
added 724 characters in body
|
Nov 28, 2011 at 22:22 | comment | added | Jerry Coffin |
@Daniel: Sorry, I must have misunderstood what your invert was supposed to do, and thought the intent was to produce an absolute difference. Producing a negative/positive is actually a bit simpler (see edit).
|
|
Nov 28, 2011 at 22:10 | comment | added | hiddensunset4 | I'm going to have to go over this soon, but this solution is great, it shamelessly kills my solution in terms of performance, and maintains the accuracy. However, there is something strange going on with the sign, it doesn't always output the correct sign, ie it reports the difference between 23rd and 18th of a month is 5, when since 23rd > 18th, its -5 backwards (as defined by the behaviour of the previous two examples). Hopefully I'll find where this lies later though. | |
Nov 28, 2011 at 18:13 | history | edited | Jerry Coffin | CC BY-SA 3.0 |
added 306 characters in body
|
Nov 28, 2011 at 18:07 | history | edited | Jerry Coffin | CC BY-SA 3.0 |
added 306 characters in body
|
Nov 28, 2011 at 17:58 | history | answered | Jerry Coffin | CC BY-SA 3.0 |