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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:13:20+00:00 2026-05-15T11:13:20+00:00

I am working with an old mysql database in which a date is stored

  • 0

I am working with an old mysql database in which a date is stored (without a time) as a datetime and a time is stored as a string (without a date).

In C# I then have a DateTime with a value like 2010-06-25 12:00:00 AM and a String with a value like 15:02.

What is the most concise way to combine these without a lot of overhead?

I have tried a few methods including:

DateTime NewDateTime = DateTime.Parse(OldDateTime.ToString("yyyy-MM-dd ") + TimeString);

I dislike converting the existing DateTime to a string and appending the time.

I can convert the time string to a date, but then I get today’s date and adding it as a number of ticks to the old datetime is incorrect.

Note: Don’t worry about validation, it is done elsewhere. The time is represented using 24-hour format without seconds.

  • 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-15T11:13:22+00:00Added an answer on May 15, 2026 at 11:13 am

    You can use TimeSpan.Parse to parse the time, and then add the result to the date:

    DateTime newDateTime = oldDateTime.Add(TimeSpan.Parse(timeString));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some text stored in MySQL database like this Tom gave Sarah £5
So, I'm working with a really old system which uses a person's mysql database
I am working with an old MySQL table, which serves as a log of
I Have a site and a database with 5 million rows, it's working like
I am well-versed in the old php mysql extension. I am working on my
I am working with a fairly old web app that uses MySQL as the
I am working on old sites and updating the deprecated php functions. I have
I'm working with an old sql server 2000 database, mixing some of it's information
Ok, an old hack is no longer working. Currently using MySQL 5.5.11 In my
I have a database full of autopart numbers that needs old part numbers prices

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.