Welcome, Guest
  • Author Topic: Calculating time values in PHP  (Read 2239 times)

    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Calculating time values in PHP
    « on: 12/09/07, 21:53 »
    In SQL you can calulate field entries with type set as date like this: '17:59'<'18:00' (=true).

    Is it possible to do the same in PHP using some sort of date-format?
         "I've figured it out. It's not the fords... it's what's IN them!.."

    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re: Calculating time values in PHP
    « Reply #1 on: 12/09/07, 21:57 »
    What do you know..

    I just tried plain and simple: date("17:59") < date("18:00") and heck, it worked!   :) :) :)
         "I've figured it out. It's not the fords... it's what's IN them!.."

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Calculating time values in PHP
    « Reply #2 on: 12/10/07, 02:53 »
    Hi Mattias,
    the date function of php is quite powerful.
    After one forgets things, if he doesnt use them, I allways have a link to the php manual at my desktop.
    In some projects you need more of this section, in others other parts. And php is so vast, that it is hardly possible to know all commands with its parameters.
    happy flashing
    8)
    Ronald

    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re: Calculating time values in PHP
    « Reply #3 on: 12/10/07, 16:04 »
    Yeah it's huge. Very obvious when you compare native array functions in AS and PHP.
    I find it easiest to use Google. Just by typing "php [function]" I always get to the right place at php.net.

    cheers
         "I've figured it out. It's not the fords... it's what's IN them!.."

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Calculating time values in PHP
    « Reply #4 on: 12/11/07, 03:24 »
    I think you found a new playgound ;)
    If you found how easy php goes together with asp via AMFPHP, you will never want to be without.
    happy flashing
    8)
    Ronald