tags:

views:

114

answers:

3

How could I convert a unix timestamp , i.e. from time(), into a m-d-Y string using php?

+1  A: 

date():

<?php

// If you just wish to convert the current timestamp,
// there's no need to call time() after 'm-d-Y'
echo date('m-d-Y');

?>

Output:

05-23-2010
BoltClock
+3  A: 

use date()

string date ( string $format [, int $timestamp ] )

Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given. In other words, timestamp is optional and defaults to the value of time().

Soufiane Hassou
+1  A: 

The very first example in the mktime manual entry shows you such a function. No good developer can be made of one who ignores manual lookup.

Col. Shrapnel
thats for m-d-y to time().
AFK
@AFK you desperately need to pay more attention. EVERY example on the page doing what you're asking for. Every friggin' one.
Col. Shrapnel