Solved

php format date

Posted on 2011-09-17
4
302 Views
Last Modified: 2012-08-13
Is there a way in PHP I can format "2011-09-17" to "Saturday, 17 September 2011"?
0
Comment
Question by:PeterErhard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Garry Glendown earned 250 total points
ID: 36553959
Assuming you start out with a timestamp, this should do the job:

$datestring=date("l, j F Y",$timestamp)

Open in new window


0
 
LVL 17

Assisted Solution

by:Chris Harte
Chris Harte earned 250 total points
ID: 36553965
echo  date('l \t\h\e jS \of F Y g:i:s a', mktime(0, 0, 0, 9, 11, 2011));

Should do it. More examples here

http://uk.php.net/manual/en/function.date.php
0
 
LVL 18

Expert Comment

by:Garry Glendown
ID: 36553969
If all you have is the input shown above, you could do this:

$datestring=date("l, j F Y",strtotime($inputdate));

Open in new window

0
 

Author Closing Comment

by:PeterErhard
ID: 36553991
Thank you both very much.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question