Webmastersite.net
Register Log In

Custom Date Field Display

Comments on Custom Date Field Display

babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
Posted Apr 01, 2011 - 10:25 AM:

A while ago you showed me how to display a custom date field in the format dd/mm/yyyy but putting:

<?php $dt = explode(" ", "{LINKDATEOFBIRTH}"); $parts = explode("-", $dt[0]); echo "{$parts[2]}/{$parts[1]}/{$parts[0]}"; ?>


Is there a way that I can get it to display dd m, yyy (ie 01 April 2011)?

TIA
Jill
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 05, 2011 - 5:42 AM:

Maybe by parsing it through the date functions like
<?php
$dt = explode(" ", "{LINKDATEOFBIRTH}");
$parts = explode("-", $dt[0]); echo "{$parts[2]}/{$parts[1]}/{$parts[0]}";
$time = strtotime("{$parts[0]}/{$parts[1]}/{$parts[2]}");
echo strftime("%d %B %Y", $time);
?>

If that doesn't work I can write the code as a $10 custom project.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.