I know it is a basic question, but let's say that I have a variable called "gameDate" that returns a date from a database. The output is coming back as 2010-02-02 00:00:00, however I would like to remove the "00:00:00" from the string. Since I am not formatting a date, but rather the variable that returns a date, can you please let me know how to do this?
Thanks in advance!!!
Basic Date Formatting Question
Moderator: General Moderators
Re: Basic Date Formatting Question
http://www.php.net/manual/en/datetime.format.php
Or what I would do is turn it into a timestamp and use the date() function to format it.
Or what I would do is turn it into a timestamp and use the date() function to format it.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Re: Basic Date Formatting Question
Change your query to use the DATE() function: http://dev.mysql.com/doc/refman/5.1/en/ ... ction_date
Or, failing that, use strtotime:
Or, failing that, use strtotime:
Code: Select all
$justDate = date('Y-m-d',strtotime($dateTimeFromDB));Real programmers don't comment their code. If it was hard to write, it should be hard to understand.