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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:06:41+00:00 2026-06-13T22:06:41+00:00

I know this question has been asked many times here, but no answer has

  • 0

I know this question has been asked many times here, but no answer has provided me with a solution yet. Please help, I’m beating my head against the wall.

Problem:
I have a simple ASP.NET web forms app with one page – Default.aspx. This page has jQuery, JSON2, Rick Strahl’s ServiceProxy.js, and my javascript file referenced (timezone.js). In the same project I have a WCF service that I call from timezone.js using ServiceProxy (which is a convenient wrapper around jQuery’s .ajax POST). The call should return an object that has a DateTime property. I am testing on two client machines in different time zones and getting different results.
Here are the screenshots of the app hosted is IIS:

EDIT: Looks like StackOverflow isn’t letting me post images. Here is the rendered text…

On the GMT machine I get:
Date rendered by js from WCF call: Fri Sep 28 13:30:00 UTC+0100 2012

On the Eastern Standard Time machine I get: Date rendered by js from WCF call:
Fri Sep 28 08:30:00 EDT 2012

As you can see on the right side of both screenshots, the WCF call results in different times.

I want complete control over what dates are sent back and I’m this close to converting it to a string on the server and parsing the string in javascript. I also must use POST to a WCF Enabled Ajax Service.

Here is the code behind for Default.aspx

public class DateContainerObject
{
    public DateTime theDate { get; set; }
}

public static class DateMaker
{
    public static DateContainerObject MakeDateObj()
    {
        DateContainerObject obj = new DateContainerObject();
        DateTime origUTCDate = new DateTime(2012, 9, 28, 13, 30, 0);
        DateTime newKindDate = DateTime.SpecifyKind(origUTCDate, DateTimeKind.Unspecified);
        obj.theDate = newKindDate;

        return obj;
    }
}

public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Literal1.Text = DateMaker.MakeDateObj().theDate.ToString();
    }
}

Here is the WCF Service code:

[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class TimeZoneService
{
    [OperationContract]
    public DateContainerObject GetDateObject()
    {
        return DateMaker.MakeDateObj();
    }
}

This is the timezone.js code:

$(function () {

var dObj = {};
var proxy = new ServiceProxy("/TimeZoneService.svc/", { isWcf: true });
proxy.invoke("GetDateObject",
        dObj,
        function (result) {
            $('#spanDateJSRender').text(result.theDate);
        },
        function (e) {
            alert(e);
        },
        function () { },
        false
        );

});

I’ve tried specifying the DateTimeKind to all different values, but it doesn’t give me accurate date and time. I’ve also tried using DateTimeOffset and I get the same results.
What can I do with this example to get the exact DateTimes that are created on the server to render in the browser?
Thanks for your help.

  • 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-13T22:06:42+00:00Added an answer on June 13, 2026 at 10:06 pm

    Just to wrap this up. I’m converting my DateTime objects to strings and having JavaScript parse them on the client. This doesn’t feel too good, but it works.

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

Sidebar

Related Questions

I know this question has been asked many times on here but I have
I know this question has probably been asked so many times here, but I
I know this question has been asked many times, but here are my specific
I know this question has been asked many times. But from what I read,
I know this question has been asked many times, but I couldn't manage to
I know this question has been asked so many times before. But I just
I know this is a question that has been asked many times before, but
I know this question has been asked many times, but my problem is a
I know this question has been asked many times, but I am having trouble
I know this question has been asked many times, but I never saw a

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.