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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:30:10+00:00 2026-05-15T02:30:10+00:00

I have unix timestamps from time zone X which is not known, the current

  • 0

I have unix timestamps from time zone X which is not known,

the current timestamp(now()) in TZ X is known 1275143019,

how to approach a javascript function so that it can generate the datetime in the users current TZ in the format 2010-05-29 15:32:35 ?

UPDATE

I’m not a unix timestamp expert,if unix timestamp is always the same in different TZ,

then I have to change the question a little,so that the current datetime in TZ X is known(like 2010-05-29 22:32:28),and the other datetime is also in this format,how to convert them to the user’s TZ based on the difference between now() ?

UPDATE

Something strange from MySQL:

On server:

mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2010-05-29 18:34:30 | 
+---------------------+
1 row in set (0.00 sec)

mysql> select UNIX_TIMESTAMP();
+------------------+
| UNIX_TIMESTAMP() |
+------------------+
|       1275143674 | 
+------------------+
1 row in set (0.00 sec)

On local:

mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2010-05-29 22:41:30 |
+---------------------+
1 row in set (0.00 sec)

mysql> select UNIX_TIMESTAMP();
+------------------+
| UNIX_TIMESTAMP() |
+------------------+
|       1275144091 |
+------------------+
1 row in set (0.00 sec)

Why the difference between now() (2010-05-29 22:41:30-2010-05-29 18:34:30=6hours) and UNIX_TIMESTAMP() (1275144091 - 1275143674 = 417seconds) is not the same ?

  • 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-15T02:30:11+00:00Added an answer on May 15, 2026 at 2:30 am

    When you instantiate a Date object, you can pass in a Unix-style “milliseconds since the epoch” time value:

    var date = new Date(milliseconds);
    

    That time value is interpreted as UTC. When you call toString on that date object, or use the getters for hour/minute/second, you get values in the local timezone at the client.

    As noted by @vava in a comment, the milliseconds or seconds current time value you get back from Unix/Linux is always UTC to begin with, so your server can drop that value into a page and when it executes on the client, the right thing will happen.

    edit — If you need to convert from local time on the server to local time at the client, you really need to get your server time in UTC, or at least know the UTC offset. From year/month/day hour/minute/second values you can set up a Javascript date with the “setUTCFoo” functions (where “Foo” if “FullYear”, “Month”, “Date”, “Hour”, “Minute”, “Seconds”, “Milliseconds”).

    https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Date

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

Sidebar

Related Questions

I have a table with statistics and a field named time with Unix Timestamps.
I have unix timestamps in my database. Now I want to get only results,
So i have this function to show the time generated from the inserted unix
I have a Unix timestamp that comes from a database that is (unfortunately) in
I have two unix timestamps as LONG INT. I want to subtract start from
I have a timestamp value from PHP: 1188604800000 When I format the time to
I have a Unix timestamp that I need to get the individual year, month,
I have a unix timestamp that I would like to convert using mysql if
Assuming I have a unix timestamp in PHP. How can I round my php
I have the following code to determine the unix timestamp of midnight tomorrow. It

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.