Something is wrong with "date" => 1970
| From: | Michelle Konzack | Date: | Sat, 16 Sep 2017 10:42:08 +0000 |
| Subject: | Something is wrong with "date" => 1970 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-326216@lists.php.net to get a copy of this message | ||
Hello *,
the code sniplet is:
----[ 'energy_harvesting.php' ]-----------------------------------------
$LIST=shell_exec('ls /srv/CONFIG_www.miila-mahe-aed.eu/htdocs/renewable_energies/data/20*.data
|sort');
$ARRAY=preg_split('/\s+/', $LIST, -1, PREG_SPLIT_NO_EMPTY);
$TITLE = "";
foreach ( $ARRAY AS $DAY) {
include $DAY;
$NEW_TITLE = date('Y', $date);
if ( $NEW_TITLE != $TITLE ) {
echo '<TABLE class="table_energy">';
echo '<TR class="table_energy_row">';
echo ' <TD class="energytable_title" colspan="6"><SPAN
class="comments">' . $NEW_TITLE . '</SPAN></TD>';
echo '</TR>';
echo '<TR class="table_energy_row">';
echo ' <TD class="energytable_num" ><SPAN
class="comments">No</SPAN></TD>';
echo ' <TD class="energytable_date" ><SPAN
class="comments">Date</SPAN></TD>';
echo ' <TD class="energytable_time" ><SPAN
class="comments">Time</SPAN></TD>';
echo ' <TD class="energytable_wh_solar"><SPAN
class="comments">Wh Solar</SPAN></TD>';
echo ' <TD class="energytable_wh_wind" ><SPAN
class="comments">Wh Wind</SPAN></TD>';
echo ' <TD class="energytable_comment" ><SPAN
class="comments">Comments</SPAN></TD>';
echo '</TR>';
$TITLE = $NEW_TITLE;
}
echo "<PRE>";
echo $DAY . "</P>";
echo $date . "</P>";
echo $NEW_TITLE . "</P>";
echo "</PRE>";
}
------------------------------------------------------------------------
it does not work as expected.
$DAY is corect the filename.
$date is a value inside the (php) file and is correct e.g. 2017-08-31
However, $NEW_TITLE is not working and show always "1970 January"
Where is my thinking error?
Does date() not more accept an ISO Date of 2017-08-31?
I had already used it and it was working properly.
Thanks in avance
--
Michelle Konzack Miila ITSystems @ TDnet
GNU/Linux Developer 00372-54541400
Attachment: [application/pgp-signature] Digital signature signature.asc
Attachment: [application/pgp-signature] Digital signature signature.asc