EverLearner Posted December 20, 2011 Share Posted December 20, 2011 Purpose: To get time zone of a remote file in my time zone. I have to download a file daily (mp3, don't worry its legal!) from BBC. Problem is that sometimes BBC doesn't update the file and i have to download entire file to check if it has been updated or not. Hence i decided to code a page that gives me date and time of that remote file. I have successfully compiled the code (that i got from internet). But the time returns in EST. I want the time in IST (indian std time Asia/Calcutta). CURLINFO_FILETIME has bee used. Below is code. Pls suggest me how to convert EST to IST - Warning: I am a newbie. But i can follow instructions <?php $curl = curl_init('http://wsdownload.bbc.co.uk/hindi/tx/32mp3/din_bhar.mp3'); //don't fetch the actual page, you only want headers curl_setopt($curl, CURLOPT_NOBODY, true); //stop it from outputting stuff to stdout curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // attempt to retrieve the modification date curl_setopt($curl, CURLOPT_FILETIME, true); $result = curl_exec($curl); if ($result === false) { die (curl_error($curl)); } $timestamp = curl_getinfo($curl, CURLINFO_FILETIME); if ($timestamp != -1) { //otherwise unknown echo "BBC Hindi was last modified" . date("d-m-Y h:i:s A T", $timestamp); //etc } ?> I have used it with custom getRemoteFileSize function here:- http://island.web44.net/bbc.php Quote Link to comment https://forums.phpfreaks.com/topic/253521-time-zone-conversion-after-fetching-remote-file/ Share on other sites More sharing options...
MasterACE14 Posted December 20, 2011 Share Posted December 20, 2011 this is probably what you're after. date_default_timezone_set() Quote Link to comment https://forums.phpfreaks.com/topic/253521-time-zone-conversion-after-fetching-remote-file/#findComment-1299574 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.