How do I convert datetime to int?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • toolmanwill
    New Member
    • Feb 2005
    • 8
    • 3.0.6

    How do I convert datetime to int?

    I want to subtract 2 fields that use datetime format and have the result end up in integer format.
    so if the difference is 1 hour 45 minutes i need the result to be 1.75 so i can subtract that result from a setting such as 3 which means end result would be 1.25 left

    Is this possible?

    Thanks in advance

    Will
  • Colin F
    Senior Member
    • May 2004
    • 17689

    #2
    It's in seconds, so you could divide the result by 3600 and you should get to an integer.
    Best Regards
    Colin Frei

    Please don't contact me per PM.

    Comment

    • toolmanwill
      New Member
      • Feb 2005
      • 8
      • 3.0.6

      #3
      yeah i figured that and have this code but keep getting 0 as a result

      Code:
      [SIZE=2]
      $elapsed = (($zaw["last_action"] - $zaw["started"]) / 3600);
      [/SIZE]

      Comment

      • Colin F
        Senior Member
        • May 2004
        • 17689

        #4
        Doublecheck that the $zaw values are actually set.
        Best Regards
        Colin Frei

        Please don't contact me per PM.

        Comment

        • toolmanwill
          New Member
          • Feb 2005
          • 8
          • 3.0.6

          #5
          ok thank you for the quick help Colin, will try a few things today

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...