Reputation: 101
Sorry if this exists, I just can't find it anywhere.
I'm using $timestamp =date('l jS \of F Y h:i:s A');
to save Sunday 16th of June 2019 09:59:40 PM
How would I go about getting it to output DD/MM/YYYY 00:00
with 24hr format rather than the AM/PM taking up space.
There's some with MM/DD/YYYY
but I don't know how to modify it.
Any pointers would be appreciated, thanks in advance.
Upvotes: 1
Views: 42
Reputation: 27082
Hours in 24 hours format is H
.
date('d/m/Y H:i')
For more options check the Manual, https://www.php.net/manual/en/function.date.php
Upvotes: 0
Reputation: 1801
The format you need is:
date('d/m/Y H:i:s');
date function accept a string parameter and you can compose it as you need using the formatting options that you can find here: https://www.php.net/manual/en/function.date.php
Upvotes: 1
Reputation: 424
Everything you need to know can be found in the manual: https://www.php.net/manual/en/function.time.php
d // days in numbers 01-31
m // months in number 01 - 12
Y // years in 4 digits
H // hours in numbers 00.00 - 23.00
i // minutes in numbers
The timestamp would look like this:
$timestamp =date('d/m/Y H:i');
Upvotes: 1