Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9201919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:08:02+00:00 2026-06-17T23:08:02+00:00

I want to pass my PHP server time to my JavaScript file. PHP Code:

  • 0

I want to pass my PHP server time to my JavaScript file.

PHP Code:

date_default_timezone_set('Australia/Perth');
echo date("r");

JavaScript:

$.get('time.php', function(data) {
  today = new Date(data);
  closing = new Date(data);
});

The PHP code returns Sun, 18 Mar 2012 12:01:23 +0800 which is correct time for Australia/Perth. But this returns an invalid JavaScript date object.

When I try to convert it to timestamp like:

 echo strtotime(date("r"));

I get the JavaScript date Sun Mar 18 2012 04:03:14 GMT+0000 (WET) (this is the value of today js var)

If I use:

echo gmstrftime('%s');

I get: Sat Mar 17 2012 20:04:30 GMT+0000 (WET).

Can anyone please help me out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:08:04+00:00Added an answer on June 17, 2026 at 11:08 pm

    The PHP code in Luna’s answer with echo date isn’t exactly like JavaScript code. This will mimic the JavaScript code exactly:

    echo date('D M d Y H:i:s O');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want that when person types: quizz.pl/emit/myvariable server will call file emit.php and pass
i want to pass large variables to a PHP script on another server with
I want to call a PHP file but want to pass an argument to
I want to pass the id of the INPUT field to the PHP file
I want to pass JavaScript variables to PHP using a hidden input in a
I am writing PHP code where I want to pass the session id myself
I want to pass parameters from PHP Command Line Interface, and then read in
I want to pass sValue that contain non-English String .... $.post(ajax.php?module=test&action=updates&id=+id+&field=+field+&val=+sValue; ... Then $valUpdate
I'm playing with the flickr api and php. I want to pass some information
I have a php file in which a GET a variable from another PHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.