Click here to Skip to main content
13,510,146 members
Rate this:
Please Sign up or sign in to vote.
See more:
I've been tasked with converting old code created using Borland C++ Builder and creating something we can use again. I think I'm mostly on the right track except I'm stuck with some of the form stuff.

double startTime = (int)(Form1->DatePickerStart->Date.Val) + Form1->ExtractDays(Form1->TimeEditStart->Text);

I'm having trouble figuring out what this double will look like. I tried just taking a date time and converting it to ticks but that didn't work.

Can anyone read this?

DatePickerStart is just a calendar date picker, and Time Edit Start is just a time selector. But converting the date to an int and adding the time converted to days and making it a double seems weird to me and I can't just picture what this is creating. An example would be helpful I think
Posted 28-Mar-12 7:25am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


It has been a long time since I used the Borland compiler but I believe the double returned from the date picker was identical to the double within the COleDateTime[^].

Best Wishes,
-David Delaune
Espen Harlinn 29-Apr-12 12:54pm
Right :-D
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

To convert to time_t (unix time)[^]

TDateTime BorlandTime = somevalue;

time_t time_t_time = round((BorlandTime - 25569.0) * 86400);

25569 sets to Unix epoch 1/1/1970
86400 == seconds in day
Zebre 2-Apr-12 11:43am
I ended up using your idea to create this function which worked for me.

double GetTimeTSecondsFrom(long ticks)
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
return (new DateTime(ticks) - epoch).TotalSeconds;

Thanks for the help!
pwasser 2-Apr-12 19:12pm
Glad it helped. You called it an idea but this is the exact conversion you asked for.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If it created a double, try converting that back into a datetime and see if the result is what you expect. The debugger will come in handy here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180417.1 | Last Updated 28 Mar 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100