PHP Time function (HH : MM) Help >>>

Discussion in 'PHP' started by westlifee21, Jul 5, 2007.

  1. #1
    Hi PHP warriers,
    Can u just help in a time and date functionality in PHP. I wanna insert just the hour and minute in a PHP page and Update it in MySQL database as Time field.

    Thanks

    West
     
    westlifee21, Jul 5, 2007 IP
  2. uglyboy

    uglyboy Peon

    Messages:
    1,963
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #2
    uglyboy, Jul 5, 2007 IP
  3. westlifee21

    westlifee21 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Uglyboy that was a great site. But i Have to insert just the hour and minute to the time field in mysql database. How i can do that?? cos if i need to do some time calculation at a later time it should not create problems.

    Can u help me on this regard???
     
    westlifee21, Jul 5, 2007 IP
  4. uglyboy

    uglyboy Peon

    Messages:
    1,963
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Im not sure that you could only insert hour and minute and have it work for you.. Even though i dont really know what it is you want to do...

    I believe you would have insert year, month, day, hour, minute, second. to be able to do any calculations .. Then you display whatever parts you require..
     
    uglyboy, Jul 5, 2007 IP
  5. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #5
    just insert the actual time and then when you reference it outside of mysql (select the data for output) just grab the hour and minutes.

    
    select date_format(my_date,'%h:%m') as hour_min from tbl1
    
    Code (markup):
     
    ansi, Jul 6, 2007 IP
  6. westlifee21

    westlifee21 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thank u very much..
     
    westlifee21, Jul 6, 2007 IP