Solved

php format date

Posted on 2011-09-17
4
293 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
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
Garry-G 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 17

Expert Comment

by:Garry-G
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

777 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