Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/29/2024 in all areas

  1. The mysql function NOW() gives the current datetime. mysql> SELECT timestampdiff(DAY, '2024-01-28 09:41:36', NOW() ) as diff; +------+ | diff | +------+ | 1 | +------+
    1 point
  2. There is a popular library for enhancing the basic datetime api, called Carbon. One of the nice things that comes with it is "Human Diff". See the manual: https://carbon.nesbot.com/docs/#api-humandiff
    1 point
  3. PHP $created = new DateTime('2024-01-27 09:41:00'); $visited = new DateTime('2024-01-29 09:41:00'); echo $visited->diff($created)->format('%a days'); // 2 days SQL SELECT created , visited , timestampdiff(DAY, created, visited) as days FROM test_1; +---------------------+---------------------+------+ | created | visited | days | +---------------------+---------------------+------+ | 2024-01-27 09:41:00 | 2024-01-29 09:41:00 | 2 | +---------------------+---------------------+------+
    1 point
  4. Except that trying to execute ini_set('display_startup_errors', '1'); when the code doesn't run because of startup errors, is as much use as a chocolate teapot. It has to be set in the php.ini file.
    0 points
This leaderboard is set to New York/GMT-05:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.