how to store time picker value to database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ilasenthi27
    New Member
    • Apr 2015
    • 1

    how to store time picker value to database

    hi.. i'm php beginner,implem enting payroll system based on salary per hour.. i want to store the time value on database.the time value get from time picker.
    and database has wrkingtime as time datatype..
    here the problem is...

    Time picker gives(hh:mm + meridian)
    database -store data format is (hh:mm:ss)

    when i enter 4:30PM ----> it stored on database is 00:00:04
    plz anyone help me
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you have to convert you input format to the database format.

    ex.
    Code:
    $ex = new DateTime('4:30PM');
    echo $ex->format('H:i:s'); // 16:30:00
    ideally you can configure your time picker to return the database format.

    Comment

    Working...