# Support Board

Date/Time: Mon, 17 Jun 2024 07:21:19 +0000

## [Programming Help] - Getting the Seconds between 2 SCDateTime objects, which may or may not be > 24 hrs

### View Count: 146

 [2024-05-21 15:38:46] #1 ycomp - Posts: 291 How can I get the # of seconds difference between 2 SCDateTime objects, even if it is more than 24 hours between them? currently I'm using .GetAsDouble() to find the difference in double.. then I can make a SCDateTime from that double, but I can't figure out how convert that to seconds? is there a way I can just convert the double directly to seconds? for ease of reference: Working with the SCDateTime Variables and Values Date Time Of Last Edit: 2024-05-21 15:40:37
 [2024-05-21 16:17:01] #2 User431178 - Posts: 434 is there a way I can just convert the double directly to seconds? Multiply double value by seconds per day, 86400, that is all. Date Time Of Last Edit: 2024-05-21 16:17:15
 [2024-05-22 08:02:10] #3 ycomp - Posts: 291 great, much appreciated
 [2024-05-22 10:02:53] #5 ycomp - Posts: 291 /*** Total Seconds (i.e. that can be > 24 hours) ***/   inline constexpr double SECONDS_IN_DAY = 24 * 60 * 60;   /**    * @param seconds the total seconds    * @return the SCDateTime value    */   inline SCDateTime fromSeconds(int64_t seconds) {     return SCDateTime{ seconds / SECONDS_IN_DAY };   }   /**    * @param dt the SCDateTime    * @return the SCDateTime value as total seconds    */   inline int64_t seconds(const SCDateTime& dt) {     return static_cast( dt.GetAsDouble() * SECONDS_IN_DAY);   }   /**    * @param dt1 the first SCDateTime    * @param dt2 the second SCDateTime    * @return the number of seconds between dt1 and dt2    * - positive if dt1 is later than dt2, negative if dt1 is earlier than dt2    */   inline int seconds(const SCDateTime& dt1, const SCDateTime& dt2) {     return static_cast( seconds(dt1) - seconds(dt2) );   }