smurf around with dates..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jim
Forum Contributor
Posts: 238
Joined: Fri Apr 19, 2002 5:26 am
Location: Near Austin, Texas

smurf around with dates..

Post by Jim »

Two questions...

First, how do I get the date to display the full name of the day of the week, such as "Friday" rather than "Fri".

Also, I'm using the following function to change timestamps from a MYSQL DB into something understandable by most folk:

Code: Select all

function formatDate($val)
{
	$arr = explode("-", $val);
	return date("D F Y", mktime(0,0,0, $arrї1], $arrї2], $arrї0]));
}
When I use it, the year seems to come up as 1969. How do I fix that?

Thanks for help!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http://www.php.net/manual/en/function.date.php
he following characters are recognized in the format string:
...
l (lowercase 'L') - day of the week, textual, long; e.g. "Friday"
strtotime
strtotime -- Parse about any English textual datetime description into a UNIX timestamp
hope this is helpful ;)
User avatar
BigE
Site Admin
Posts: 139
Joined: Fri Apr 19, 2002 9:49 am
Location: Missouri, USA
Contact:

Post by BigE »

There are also MySQL functions for timestamps in the database such as UNIX_TIMESTAMP(). I suggest you read the MySQL manual on how to do this. Hope that helps.
Post Reply