CodeIgniter Forums
Manage dates from a form - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: Best Practices (
+--- Thread: Manage dates from a form (/showthread.php?tid=76260)

Manage dates from a form - Marcolino92 - 04-27-2020

Hi, I was wondering what was the best practice for saving a date from a form?

To save each day, month and year field individually as numerical values? 01/01/2020

I have tried many techniques, also to be able to subsequently manage them regarding a possible translation, but I do not find them practical.

You sending a form date, day, month and year, how do you manage them?

RE: Manage dates from a form - kris2 - 04-27-2020

Personaly, in the database I use ISO forma yyyy-MM-DD

and I use bootstrap css and bootstrap doo all the hard job. I have a smal calendar, it works fine with mobile. just

On my view I have this example

<div class="form-group row">

<span class="col-sm-2 col-form-label" >Date</span>

<div class="col-10">
if ($action == "add"){ $tfdate = date('Y-m-d');} else{$tfdate = $r['tfdate'];}
$data = array(
'name' => 'tfdate',
'type' => 'date',
'value' => $tfdate,
'style' => 'form-control'
echo form_input($data);