I would like to generate an XML file with every third date up to a given date (for example, 10th of June) since the Unix Epoch, at 3pm GMT. Like:
<timestamps>
<timestamp time="1246000000" text="2011-06-10 15:00:00" />
</timestamps>
Thank you! I need it in PHP!
Not sure if i thoroughly understand your question, but here's some code which generates what I'm guessing you want. Send in a timestamp (seconds since epoch).
<?php
function generateXML($end_time){
$three_days = 3 * 24 * 3600;
echo "<timestamps>\n";
for ($stamp = 15 * 60 * 60; $stamp < $end_time; $stamp += $three_days){
$text = date('Y-m-d H:i:s', $stamp);
echo "<timestamp time=\"$stamp\" text=\"$text\" />\n";
}
echo "</timestamps>";
}
# up to now:
generateXML(time());
?>