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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:05:37+00:00 2026-06-18T19:05:37+00:00

I have compiled the below code in c# string datetime = String.Format({0:MM/dd/yyyy hh:mm:ss tt},

  • 0

I have compiled the below code in c#

string datetime = String.Format("{0:MM/dd/yyyy hh:mm:ss tt}", root.SelectSingleNode("lasttime").InnerText);



lastUpdateTimestamp = DateTime.ParseExact(datetime, "MM/dd/yyyy hh:mm:ss tt", CultureInfo.CurrentCulture);

but in output i am getting lastUpdateTimestamp is 2/8/2013 7:00:24 AM instead of 02/08/2013 07:00:24 AM

Any idea what i am missing?

After getting this value i am running a query and getting this error

Invalid month in timestamp "2": cannot find leading zero [SQL query syntax invalid or unsupported.]

Hi All , i got the solution , Rather than passing lastUpdateTimestamp i am now taking date in a string variable and teking its value in proper format. Its working

  • 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-18T19:05:38+00:00Added an answer on June 18, 2026 at 7:05 pm

    root.SelectSingleNode("lasttime").InnerText returns a string.

    You are trying to use a DateTime format specifier to format a string.

    Not sure what you are trying to do but something like this should work

    string xmlstring = root.SelectSingleNode("lasttime").InnerText;
    DateTime parsed = DateTime.ParseExact(xmlstring, "M/d/yyyy h:mm:ss tt");
    
    string datetime = string.Format("{0:MM/dd/yyyy hh:mm:ss tt}", parsed);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a doubt on basic C++ usage. The code below, compiled with gcc/LInux,
Say I have a string of code as below that I compile in my
I have code as shown below for detecting if a string has any matches
I have presented the code below. The compiler throws error when I overload an
The sampled code below is for the GUI I am currently making. I have
I have been running the python code below for approx a year now. But
Assuming that: The C# source code below is compiled under .NET 2.0 (CLR 2.0);
When I compiled the code (found below) on Linux, gcc said: error: request for
The code below compiles without error... for once I would have preferred it to
I have compiled my preload file on Ubuntu server (two files for x32 and

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.