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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:44:18+00:00 2026-05-18T12:44:18+00:00

[Please vote to close this – see my last comment.] Hi, Something like this:

  • 0

[Please vote to close this – see my last comment.]

Hi,

Something like this:

DateTime.ParseExact("25/12/2008 00:00:00", "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);

works fine on my development machine but not after deployment (server).

I guess it has to do with some time zone configuration. I have tried:

<%@ ... UICulture="en" Culture="en-US" %> 

with no avail. Any suggestions on a postcard please. Thanks.

Christian

PS: Exception:

String was not recognized as a valid DateTime

PPS: I have updated the question. I actually feed in the time bit. sorry about that!

PPPS:
I have now realised that all this has to do with Excel and oledb. The string 25/12/2008 looks like this “12/25/2008 12:00:00 AM” on the server and like this “25/12/2008 00:00:00” on the developement machine. I adjusted the time zone of the server to UK without avail. What else can I do? Thank and sorry about all this confusion!!!

  • 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-18T12:44:19+00:00Added an answer on May 18, 2026 at 12:44 pm

    Something like this

    You’d do better posting exactly what failed, and the exact error, rather than “something like” what failed.

    I would expect your sample to give a FormatException, since the string you’re converting (“25/12/2008”, no time) does not match the format specified (“dd/MM/yyyy hh:mm:ss”).

    Also a bit strange to be using hh rather than HH in your format – hh is a 12-hour clock.

    I would expect any of the following to work.

    // No time component
    DateTime.ParseExact("25/12/2008", "dd/MM/yyyy", new CultureInfo("en-US"));
    
    // Works for hours <=12, result is always AM
    DateTime.ParseExact("25/12/2008 11:00:00", "dd/MM/yyyy hh:mm:ss", new CultureInfo("en-US"));
    
    // Works for hours using 24-hour clock
    DateTime.ParseExact("25/12/2008 13:00:00", "dd/MM/yyyy HH:mm:ss", new CultureInfo("en-US"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Disclaimer Please don't just vote to close this because the title looks subjective, and
Please consider this example class: [Serializable] public class SomeClass { private DateTime _SomeDateTime; public
Please one library per answer so that people can vote for the individually.
Please explain to me why the very last echo statement is blank? I expect
please ignore this post, I misread algorithm, so the question is not relevant. However,
Please help me to discover whether this is a bug in Python (2.6.5), in
(please excuse that I didn't use aliases). I would like my query output to
Please suggest some good resources to start writing Java Web services.
Please read the whole question. I'm not looking for an approach to managing multi-lingual
Please give me the direction of the best guidance on the Entity Framework.

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.