How to save to database using Kartik Timepicker in Yii2

I am working on a timetable schedule. I want to save start_time and end_time into database using yii2-widget-timepicker from kartik. as shown below:


I have these question:

  1. what datatype do I use in the table database
  2. How do I format the timepicker
  3. How do I save and retrieve the time. I need an example


Use “time” type field.

About format the timepicker, take a look at doc :

Thanks. But what datatype do I use since am saving the AM and PM. For example 01:15 PM And how do I retrieve it

Why don’t you save in 24 hours format? So it is also standard

1 Like

Ok. Thanks