Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

mysql and delphi "DateTime"

Posted on 2009-04-05
4
Medium Priority
?
1,914 Views
Last Modified: 2012-05-06
how to convert mySQL datetime (yyyy/mm/dd ss:mm:hhhh) to TDateTime (dd/mm/yyyy ss:mm:hhhh)
0
Comment
Question by:pete_03
[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
  • 3
4 Comments
 
LVL 7

Expert Comment

by:tankergoblin
ID: 24073938
what you want to do
insert datetime to database
or display it on windows?
0
 
LVL 7

Expert Comment

by:tankergoblin
ID: 24073946
you can try

myDate := EncodeDateTime(2000, 6, 5, 1, 2, 3, 4);
FormatDateTime('dd/mm/yyyy ss:mm:hhhh', myDate));
0
 
LVL 19

Accepted Solution

by:
MerijnB earned 200 total points
ID: 24074529
Is this field defined as a datetime in the mysql database?
If yes, just go:

var DataSet: TDataSet;
    DateTime: TDateTime;
begin
 DateTime := DataSet.FieldByName('MyDateField').AsDateTime;
end;

Open in new window

0
 
LVL 7

Expert Comment

by:tankergoblin
ID: 24074766
if you want to select from query you can do as follow


FHolidayDates := TStringList.Create;
FHolidayDates.Add(FormatDateTime('dd/mm/yyyy ss:mm:hhhh', FieldByName('columnName').AsDateTime));
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

721 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