Avatar of peter_coop
peter_coopFlag for United Kingdom of Great Britain and Northern Ireland asked on

date format help needed

i have a mysql timestamp which is in the format

2008-05-29 11:00:14

i need it to display 29-05-2008 11:00:14

i have tried various codes, but cannot get it to display uk format. any help would be appreciated as it's driving me crazy. thanks

Avatar of undefined
Last Comment

8/22/2022 - Mon
Guy Hengel [angelIII / a3]

the date_format() function should be able to do that:

DATE_FORMAT(your_column, '%d-%m-%Y %T')

Open in new window

Aleksandar Bradarić

In PHP, you can use:
echo date('d-m-Y H:i:s', strtotime('2008-05-29 11:04:14'));

i am having trouble seeing where to place this code in relation to the attached function. any help? thanks
function print_acts($act){
	$print .= '<table width="70%"  border="0" align="center">' . "<tr><td><strong><font color='#FF6600' size='6'>sample</font></strong></strong><br />sample<br /><hr><p><strong><font color='#000000' size='4'>ACTION CONTROL AREA</font></strong></strong></p></td></tr>" . '<br />' .'<table width="70%" border="1" align="center">' ."<tr bgcolor='#CCCCCC'><td><strong>Service</strong></td><td><strong>Customer</strong></td><td><strong>Department</strong></td><td><strong>Activity</strong></td><td><strong>Item</strong></td><td><strong>Date</strong></td><td><strong>Quantity</strong></td><td><strong>Type</strong></td><td><strong>Action</strong></td></tr>";
	$num=mysql_numrows($act) ;
	while ($i < $num) {
		$service = mysql_result($act,$i,"service");
		$company = mysql_result($act,$i,"company");
		$department = mysql_result($act,$i,"department");
		$activity = mysql_result($act,$i,"activity");
		$item = mysql_result($act,$i,"item");
		$date = mysql_result($act,$i,"date");
		$quantity = mysql_result($act,$i,"quantity");
		$type = mysql_result($act,$i,"type");
		$new = mysql_result($act,$i,"new");
		$print .= format_act($service,$company,$department,$activity,$item,$date,$quantity,$type,$new);
	$print .= "</table>";
	return $print;

Open in new window

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Aleksandar Bradarić

$date = date('d-m-Y H:i:s', mysql_result($act,$i,"date"));
Guy Hengel [angelIII / a3]

my suggestion would not go in that part of the code, but in the sql query that is used to fill the $act variable.
Aleksandar Bradarić

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

thanks once again
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.