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 7544751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:45:16+00:00 2026-05-30T08:45:16+00:00

I am preparing data to pass to my Javascript in PHP. Encoding that data

  • 0

I am preparing data to pass to my Javascript in PHP. Encoding that data using json_encode and passing it.

One of the elements I am trying to pass is a javascript timestamp. PHP timestamps are in seconds, Javascript timestamps in milliseconds, so i need to multiply the php timestamp by 1000.

The problem is that the resulting int is too large and gets sent at 1.3239E+12 instead of 1323907200000 losing around 1 day of precision on the way.

One way to do it would be to pass a Date.UTC() function in the json but there’s no easy way to do it using json_encode.

Any solution?

  • 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-05-30T08:45:18+00:00Added an answer on May 30, 2026 at 8:45 am
    $jstimestamp = (string) time() + "000";
    

    Try that. I solved a similar problem the same way. However, the easiest is to multiply in the Javascript or divide the js-timestamp with 1000.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I set a data member, imageUri, and pass that into an intent that launches
I am preparing a web page with more data that can possibly be shown
I'm trying to send data to a server. That is, some string fields and
I'm preparing for an interview and one of the questions that tends to come
I'm preparing to deploy my Django app and I noticed that when I change
I'm preparing a string that will be eval 'ed. The string will contain a
Preparing data in json format on backend and populating data to templates via ajax
I'm trying to create a multiaction web controller using Spring annotations. This controller will
I am preparing an offer for a customer. They proide weekly data to different
I have a query that strips data from a XML string, inserts it into

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.