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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:27:58+00:00 2026-05-12T11:27:58+00:00

I am sending in a strings in with the date part, hour part and

  • 0

I am sending in a strings in with the date part, hour part and minute part and AM/PM Now I want to make this into a DateTime. But I am unsure how to change the time part to AM/PM depending on user choice.

How do I do this?

  • 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-12T11:27:59+00:00Added an answer on May 12, 2026 at 11:27 am

    You could initialize the time with the date/hour/minute and then add 12 hours if it is PM. Alternatively, you could format the string with the am/pm and convert that to a datetime. I’ll see if I can find an example using am/pm.

    EDIT:
    Plenty of documentation in MSDN including a C# example for “2/16/2008 12:15:12 PM”.

      DateTime dateValue;
      string dateString = "2/16/2008 12:15:12 PM";
      try {
         dateValue = DateTime.Parse(dateString);
         Console.WriteLine("'{0}' converted to {1}.", dateString, dateValue);
      }   
      catch (FormatException) {
         Console.WriteLine("Unable to convert '{0}'.", dateString);
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Indy when we are sending some strings to the server , they change
I'm sending from server to clients base64 strings with decoded coordinates of some objects.
I am sending dtmf tone via this code. String number=tel:+962791212121,2,3,3; Intent c1= new Intent(android.content.Intent.ACTION_CALL,
var is:ImageSnapshot = myImagesnapshot; var str:String = ImageSnapshot.encodeImageAsBase64(is); As of now, I am sending
A client is sending a string containing a date in format YYYYMMDDHHmmSS (e.g. 201004224432
Actually, in my app I want to insert TextView in the ListView dynamically but
At browser,in JS var today = new Date() todaySendToServer = today.toString(); I am sending
I'm sending some dates from server that has it's time in gmt-6 format, but
I have a date picker sending string dates in Euro format, e.g. 02/12/2011 (December
GWT doesn't serialize Java Date properly. When I tried sending Date created in Javascript

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.