How to show today's date? date("Ymd H:i:s",time())
seemed to help, but for some reason it constantly shows the number 1970-01-1 03:00 The date("Ymd H:i:s",time())
function date("Ymd H:i:s",time())
shows date at the user or server? If the user, then how to make it show on the server?
|
1 answer
date("Ymd H:i:s");
shows server date.
upd
get rid of seconds: php
echo date("Ymd H:i",strtotime($row['date'])); //или echo substr($row['date'],0,-3);
mysql
select date_format(date,'%Y-%m-%d %H:%i') as date from table
- Put the date ("Ymd H: i: s"), when inserted into the database, why only Ymd is inserted, when outputting the date from the database, 1970-01-1 03:00 is displayed. Request for date ("Ymj H: i", $ row ['date']); Field type date - rimlin pm
- 2In the database, you need to change the field type to
TIMESTAMP
and for output in this case, you should not use the date () function - FLK - thanks, everything is fine. Just how to remove seconds? Removed from the insert request. instead of seconds he puts 00 - rimlin
- in the database, in any way, just do not display them - FLK
- I changed the time to $ time = date ("Ymd H: i") ;, but it still inserts seconds, only not real, but 00. How not to output? If we make a date back ("Ymj H: i", $ row ['date']), then it again outputs 1970-01-1 03:00. If simply $ row ['date'] then it will be 2012-04-12 22:59:00 - rimlin
|