Welcome Guest, Not a member yet? Register   Sign In
How to insert NOW() in DATETIME field
#8

(03-11-2024, 11:37 PM)InsiteFX Wrote: You can also use the Time Class.

CodeIgniter 4 User Guide - Times and Dates - now()

PHP Code:
<?php

use CodeIgniter\I18n\Time;

$now = new Time('now');

    'created_at' => $now,
    'updated_at' => $now

I can, but won't that also use the server time from where PHP is running, rather than where MySQL is running? ?

-joho
Reply


Messages In This Thread
How to insert NOW() in DATETIME field - by keop - 09-29-2020, 12:17 AM
RE: How to insert NOW() in DATETIME field - by joho - 03-11-2024, 11:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB