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

  • Home
  • SEARCH
  • 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 174459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:31:33+00:00 2026-05-11T13:31:33+00:00

I need to pass javascript date value to vb.net function. Method iam using now:

  • 0

I need to pass javascript date value to vb.net function.

Method iam using now: convert javascript date to string store it in hiddenfield retrieve string from hidden field in server code and parse it using date.parse

the trouble is that the Javascript dateformats

toString() – Sat Apr 4 22:19:00 UTC+0530 2009

toDateString() – Sat Apr 4 2009

toLocaleString() – Saturday, April 04, 2009 10:19:00 PM

doesnt match vb date format. I am getting error that its unparseable.

Thanks in advance for the 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. 2026-05-11T13:31:34+00:00Added an answer on May 11, 2026 at 1:31 pm

    The problem with using ToLocaleString is that you lose timezone info and its obviously locale specific which means you need to parse it with the right culture.

    I was thinking:-

    DateTime d = DateTime.ParseExact(sInput, ‘ddd MMM d HH:mm:ss UTCzzzz yyyy’ , CultureInfo.InvariantCulture);

    But that isn’t cross browser compliant (the ECMA spec does not define what toString should actually do).

    However we do know that the value of a Javascript Date object is the number of milliseconds from midnight Jan 1, 1970. Hence you could instead store the .valueOf of a date object in your hidden field. Use Int32.Parse on the string first, create a TimeSpan from the that value and add it to a DateTime of Jan 1, 1970 00:00:00 UTC+0000.

    int milliseconds = Int32.Parse(inputString); TimeSpan t = TimeSpan.FromMilliseconds(milliseconds); DateTime base = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); DateTime result = base + t; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If I understand your requirements correctly, you could probably use… May 11, 2026 at 11:42 pm
  • Editorial Team
    Editorial Team added an answer Try something like this: XElement xEle = new XElement("Authors", from… May 11, 2026 at 11:42 pm
  • Editorial Team
    Editorial Team added an answer You can simplify this by simply appending a newline for… May 11, 2026 at 11:42 pm

Related Questions

Hopefully this will be the last question I need to ask about this..lol.. I
I have an asp.net webservice with a parameter of type datetime. I have noticed
What is the best solution/API for this? On my site users upload image, tag
I've been asked to display the 'correct' time on our website which I frankly

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.