Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ffblk.ff_date and ff_time to Date and time 2

Status
Not open for further replies.

801119

Programmer
Apr 10, 2000
311
SE
Greetings all...

I'm trying to "convert" ff_date and ff_time to an AnsiString. But I have no idea on how to accomplish this!

BCB help files only gives me this:
Code:
ff_ftime:
Bits 0 to 4	The result of seconds divided by 2 (for example 10 here means 20 seconds)
Bits 5 to 10	Minutes
Bits 11 to 15	Hours

ff_fdate:
Bits 0-4	Day
Bits 5-8	Month
Bits 9-15	Years since 1980 (for example 9 here means 1989)

ff_ftime and ff_fdate contain bit fields for referring to the current date and time. The structure of these fields was established by the operating system. Both are 16-bit structures divided into three fields.

So if I have following:
ff_fdate = 11114
and ff_ftime = 31840
How do I convert this to a string?
I'm not looking for a code or anything, though that would be appreciated, all I need is a hint on where to start!

Thanks in advance,
Martin! My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
Greetinx!

You may try to convert to TDateTime format using TDateTime's method of
static TDateTime __fastcall FileDateToDateTime(int fileDate);
TDateTime can be converted to AnsiString with AnsiString's method of
AnsiString __fastcall DateTimeString() const;

Happy programming!))
 
Pavlo's right; however, here is a code snippet for ff_date that might help.
Code:
int direct_date;
long create_date, prior_date;

direct_date = ff.ff_fdate; // structure for ff should already have been set up
create_day =  (direct_date & 31); // day date
create_month = ((direct_date >>= 5) & 15); // month
create_year = (direct_date >>= 4) + 1980; // year (four digit)

create_date = (long(create_year) * 10000) + (long(create_month) * 100); // a number the represents yymm
create_date += long(create_day); // a number that represents yy mm dd
prior_date = (long(prior_year) * 10000) + (long(prior_month) * 100); // same as above
prior_date += long(prior_day); // same as above

I don't have a quick example of time for you. James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Greetinx!

The DateTimeString method is not AnsiString's method, its TDateTime's method.

Happy programming!))
 
Thanks to both of you, pavlo and 2ffat

I went with 2ffats version, it was something like that I was looking for, and I couldn't get DateTimeString to work.. don't know why!(?)!
Now, I only got to find a way to do the same with ffblk.ff_ftime Gonna read help files to see if I can find a solution...

thanks again... My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top