cturner Posted October 24, 2006 Share Posted October 24, 2006 Can someone please tell me how I can convert a mktime date (mktime(0,0,0,$month -1,$d,$year)) to something like 21 October 2006? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/24915-converting-mktime-to-a-normal-date/ Share on other sites More sharing options...
heckenschutze Posted October 24, 2006 Share Posted October 24, 2006 Use [url=http://php.net/date]date()[/url]eg:[code]<?phpecho date("d F Y", mktime(0, 0, 0, $month -1, $d, $year));?>[/code] Link to comment https://forums.phpfreaks.com/topic/24915-converting-mktime-to-a-normal-date/#findComment-113559 Share on other sites More sharing options...
cturner Posted October 24, 2006 Author Share Posted October 24, 2006 Thanks for your reply heckenschutze but it is displaying 0 as the 1st day of a month. I am clicking on a date in a calendar to come to the code that is below.[code]require "config.php";// get the entry date$entry_date = $_GET['entry_date'];// select the diary entry for the entry_date$query = "SELECT * FROM `diary_contents` WHERE `date` = '$entry_date'";// display the diary entries for the entry dateecho date("w F Y", $entry_date);// more code to come[/code] Link to comment https://forums.phpfreaks.com/topic/24915-converting-mktime-to-a-normal-date/#findComment-113570 Share on other sites More sharing options...
heckenschutze Posted October 24, 2006 Share Posted October 24, 2006 use 'j' instead of 'd'...[code]echo date("j F Y", $entry_date);[/code] Link to comment https://forums.phpfreaks.com/topic/24915-converting-mktime-to-a-normal-date/#findComment-113571 Share on other sites More sharing options...
cturner Posted October 24, 2006 Author Share Posted October 24, 2006 Problem is now solved thanks to heckenschutze. Link to comment https://forums.phpfreaks.com/topic/24915-converting-mktime-to-a-normal-date/#findComment-113574 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.