I have a php script that returns date in tokyo in a following format:
Thu, 01 Oct 2015 06:10:09 +0900
I already passed it to my jquery script with ajax and now store it in local variable
var myTime = 'Thu, 01 Oct 2015 06:10:09 +0900
Now I want to create a new Date()
object with that data, so then I can have an actual date from tokyo on my webpage without using local client's timezone. How can I do that?
If your PHP code returns just that string:
<?PHP echo "Thu, 01 Oct 2015 06:10:09 +0900"; ?>
Then in your jQuery ajax return:
function(data)
{
var myDate = new Date(data.trim());
//...
}//..
Example: of the raw string in jsfiddle JsFiddle
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.