how to insert time in database in php

such as 10:12 am

01:05 pm

Do you want to insert into a datetime or time column, or in a varchar column ?

datetime/time: insert into table (datetime_column) VALUES (NOW()) varchar:

$time = date('g:i A');
$query = "insert into table (varchar_column) VALUES ('$time')";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.