Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

mysql datetime enters 'AM' when I update after 12 pm?

Posted on 2014-12-15
2
Medium Priority
?
152 Views
Last Modified: 2014-12-15
I use a datetime picker to set the date but when I select it and the time on my pc is after 12:00 pm it returns it from the database as 12/15/2014 1:38:06 AM - it should be PM

string expecteddate = dtppExpectedArrivalDate.Value.ToString("yyyy-MM-dd hh:mm:ss");
                    string sentdate = dtpSentDate.Value.ToString("yyyy-MM-dd hh:mm:ss");
0
Comment
Question by:r3nder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 2000 total points
ID: 40501238
that is unusual. Can you show the string shown in expectdate and sentdate? most likely, you want capital H's for the hour string. Try this:

string sentdate = dtpSentDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
0
 
LVL 6

Author Closing Comment

by:r3nder
ID: 40501272
that worked - I guess 1 is 24 hr and 1 is 12
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question