Have two strings, one with his language, one with ENG, then do match/replace and then strtotime to convert to timestamp and then output using date function in whatever format you want
function isdst() {
$dststart = strtotime("Last Sunday March 2"); // In France DST begins last Sunday of March @ 02:00
$dstend = strtotime("Last Sunday October 3"); // In France DST ends last Sunday of October @ 03:00
$time = time();
if( $time > $dststart && $time < $dstend )
{ $offset = 2; } // In France DST = GMT + 2
else
{ $offset = 1; } // In France non DST = GMT + 1
return $offset;
}
This one is for France and works fine. DST may be adjusted in the $offset return var without forgetting
the two first line where dates of begining and end of DST must be set.
I think you are making it more complicated than it has to be, the WD date is telling you it is UTC so php can work with that directly. I would do something like this: (I don’t know if the date name is shortened or not, hard to tell with “mai” so the $franmo array is not complete.) And you’ll need to reverse the translation after the format conversion.
<?php
date_default_timezone_set('Europe/Paris');
$olddate = "17:03 UTC 13 mai 2016";
$engmo = array("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
$franmo = array("jan","fev","mar","apr","mai","jun","jul","aug","sep","oct","nov","dec");
$newdate = date("D M j G:i:s T Y",strtotime(str_ireplace($franmo, $engmo, $olddate)));
echo $olddate." = ".$newdate;
?>
I solved my problem with a small non academic php script, but it works.
I remind that my testtags.php file comes out with French formated date/times.
So my solution is turned torwards French date. I can be accomodated to other languages.
[quote]
function getlocdate ($indate) { // Incoming UTC French date in wxastronomy it is $firstquarter, $fullmoon, $lastquarter and $nextnewmoon.
if(substr($indate, 11, 1) == ’ ') {$monthfr = substr($indate, 12, 3); // Let’s get three first carracters of French month
if ($monthfr == ‘jui’) {$monthfr = substr($indate, 12, 4);} // June & July in French begin both by jui so lest’s get four fist caracters
} else {$monthfr = substr($indate, 13, 3); if ($monthfr == ‘jui’) { $monthfr = substr($indate, 13, 4); } }
[quote author=meteo link=topic=62864.msg503604#msg503604 date=1463782171]PS: @ Niko, sorry but your $franmo = array(“jan”,“fev”,“mar”,“apr”,“mai”,“jun”,“jul”,“aug”,“sep”,“oct”,“nov”,“dec”); array is wrong and further more testtags.php for these date/month returnes ‘janvier’, 'f