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

The Archive Base Latest Questions

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

I have an ajax call, which returns datetime. Javascript displays it using client timezone.

  • 0

I have an ajax call, which returns datetime. Javascript displays it using client timezone. I not need in any client timezone, I want to show datetime the same as server return. Is it possible?

I get date via:

var d = eval('new' + date.replace(/\//g, ' '));
  • 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-30T17:21:18+00:00Added an answer on May 30, 2026 at 5:21 pm

    First off, there’s no reason to use eval here (or almost anywhere), and generally lots of reasons not to.

    JavaScript has only “local” time (the timezone of the client) and UTC (universal coordinated time, effectively the same as GMT). So your best bet normally is to have the server send you the time in UTC. But in your case, since you want to display the date in the server’s timezone, it doesn’t really matter whether JavaScript thinks the date is in local time or server time, and it’s fine to send it in the server’s timezone.

    Note that when parsing date strings, JavaScript only recently (as of ECMAScript5) got a standard format for date strings, which is a simplified version of ISO-8601. Details here. Note that some older browsers will not yet support that format.

    It’s impossible to offer much more guidance without an example of what you’re trying to parse.

    Diodeus’ suggestion also seems to me to make a lot of sense: If you want the date to be displayed in the server’s timezone and format, just display the string you’re given without interpreting it (again, subject to what the string looks like; I can’t immediately come up with a reasonable format that would work with your posted code).

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

Sidebar

Related Questions

I have an ajax call in jquery which returns 4 different arrays. 3 of
On my main page I have this jquery code which does an ajax call
I have an AJAX controller action which returns JSON. The returned JSON is handled
I have simple JavaScript code that is using the Ajax API for fetching a
I'm making an AJAX call which returns XML data, and this is my 'success:'
i have an ajax function which gets called and returns json data. this function
I'm using javascript to submit a form to a webservice which returns a json
I have a system where I send an Ajax command, which returns a script
I'm making an Ajax call which returns me some info including an image path.
i have an Ajax ActionLink which normally just returns a PartialView (which is just

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.