RE: [PHP] PHP- Converting to and from TIMESTAMPS
| From: | John W. Holmes | Date: | Fri, 30 May 2003 11:28:18 +0000 |
| Subject: | RE: [PHP] PHP- Converting to and from TIMESTAMPS | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149546@lists.php.net to get a copy of this message | ||
> I am wanting one field on a table in one of my MYSQL databases to
contain
> different dates and times as a epoch timestamps.
>
> Firstly how do I convert a particular time and date which the user
will
> enter on the website into the epoch timestamp.
$db_timestamp = strtotime($user_input);
> And secondly, how do I convert it back once taken of the table. I'd
like
> to use the date function to print out this particular date and time-
for
> example $a = date('g:IA l, jS F, Y') so that $a could say '7:30PM
> Saturday, 23rd August, 2003' Does date only work by outputting the
> current date or time? Can you get it to output the format of any date
and
> time you would like?
$a = date('g:IA l, jS F, Y',$db_timestamp)
---John Holmes...