Solved

mysql and delphi "DateTime"

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Communication Between RC4 Delphi <-> PHP 3 100
code issue 8 99
Delphi - replicating a form 8 64
I want to use librsync in my Delphi backup application. 3 27
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now