I have used several hours yesterday trying to work this out, and I am stuck with errors.
When it outputs in the right format I plan on making it an url to that season-period.
I have this: <? echo $seasonstart." - ".$seasonend; ?>
Which outputs this: 2005-02-13 00:00:00 - 2005-06-04 00:00:00
but i need this: 13-02-2005 - 04-06-2005
Format of date time field from database
Moderator: General Moderators
Use strtotime function and then date.
00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>
and then date.
easonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$season and then date.
p;amp;lt;?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstarthp
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart.&qp.net/strtotime]strtotime[/url] function and then date.
trtotime[/url] function and then date.
05-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>
nend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>
ttp://php.net/date]date[/url].
0:00:00'));
echo $seasonstart." - ".$seasonend;
?>
.
ime[/url] function and then date.
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart."e; - ".$seasonend;
?>
rl] function and then date.
nend;
?>
date.
Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>
and then date.
Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>$season and then date.
Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstarthp
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart.&qp.net/strtotime]strtotime[/url] function and then date.
Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>echo $seasonstart." - ".$seasonend;
?>
nend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>
ttp://php.net/date]date[/url].
Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>echo $seasonstart." - ".$seasonend;
?>
.
Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y'p.net/strtotime]strtotime[/url] function and then [url=http://php.net/date]date[/url].Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>echo $seasonstart."e; - ".$seasonend;
?>
rl] function and then date.
Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>?>
date.
Code: Select all
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>
<?php
$seasonstart = date('d-m-Y', strtotime('2005-02-13 00:00:00'));
$seasonend = date('d-m-Y', strtotime('2005-06-04 00:00:00'));
echo $seasonstart." - ".$seasonend;
?>- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Try to minimize what PHP is doing and keep it to MySQL when possible. MySQL has a DATE_FORMAT function....
Code: Select all
SELECT DATE_FORMAT(date_column, "e;%d-%m-Y"e;) AS the_date FROM table_name