Yii Framework Forum

How to save to database using Kartik Timepicker in Yii2

(Folumikeidowu) #1

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


(Fabrizio Caldarelli) #2

Use “time” type field.

About format the timepicker, take a look at doc : http://demos.krajee.com/widget-details/timepicker

(Folumikeidowu) #3

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

(Fabrizio Caldarelli) #4

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

(Folumikeidowu) #5

Ok. Thanks