Solved

mysql and delphi "DateTime"

Posted on 2009-04-05
4
1,844 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
  • 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 50 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Internet Explorer View Settings Question 15 117
Run video youtube webbrowse 10 65
Dev Express grid collapse 2 45
can't find the executable in Simulator 1 101
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 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