| Subject: | Converting a "HEX" date and time to TDataTime [Edit] |
| Posted by: | Henrik Nedergaard |
| Date: | Thu, 30 Sep 2010 |
Hello
I have a database where I need to read som records from, in the table I read the there are stores some string values representing a date and time - it stored in hex.
they look like this
There is a space between the date and time part.
sourcetime
--------------------------------------------------
01cb087b dadcbc90
01cb087b dae3e880
01cb087b db709820
01cb087b db755310
01cb087b db7a0e00
01cb087b db8139f0
01cb087b db85f4e0
01cb087b db8ad6e0
01cb087b dbac1a80
01cb087b dbb0fc80
01cb087b dbb80160
01cb087b dbbce360
01cb087b dbde2700
01cb087b dbe552f0
01cb087b dbea34f0
I tried to convert it to TDate and TTime like this
procedure TForm1.cxButton1Click(Sender: TObject);
var
d : TDate;
t : TTime;
i64 : Int64;
tmpstr, days, hours : string;
i : integer;
begin
tmpstr := cxTextEdit1.Text;
i := pos(#32, tmpstr);
if i = 0 then exit;
days := copy(tmpstr, 1, i-1);
delete(tmpstr, 1, i);
hours := tmpstr;
d := StrToInt('$'+days);
t := StrToInt('$'+hours);
DateTimeEdit.EditValue := DateToStr(d) + ' '+TimeToStr(t);
end;
However it's not giving an usefull result - does anyone have any clue how to convert this to a TDateTime?
Edited by: Henrik Nedergaard on Sep 30, 2010 5:07 PM