RE: [PHP-WIN] date conversion
| From: | Andreas Lange | Date: | Thu, 15 Feb 2001 01:31:14 +0000 |
| Subject: | RE: [PHP-WIN] date conversion | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-5571@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Vasu [mailto:gokaraju@hotmail.com]
> Sent: Thursday, February 15, 2001 1:53 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] date conversion
>
>
> Hi,
>
> I am trying to get US date out of a DATETIME column but it
> returns "12/31/1969". The line of code that I am using is:
>
> <?php echo date("m/d/Y", $Row->FileSentDate); ?>
in php u can convert it via:
int mktime (int hour, int minute, int second, int month, int day, int year
[, int is_dst])
the return-value is unix-timestamp
> According to the documentation, the second parameter of the
> date() function requires timestamp value which is int data type.
> If any of you know how to convert a value into timestamp or any
> other solution to get US date out of a string or DATETIME column,
u can also use a simple SQL-Query (i.e. in MySQL):
"SELECT UNIX_TIMESTAMP(datetimefield) AS unixtime FROM table"
so SQL return a unix-timestamp instead of a pre-formated datetime string ;)
> please let me know.
>
> Thanks for your help.
>
>
> Vasu
Hopes this solves your probs ;)
CodeDuck