12,623,027 members (29,854 online)
Rate this:
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.

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 8:25am
Zebre150

Rate this:

## Solution 2

Hi,

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:

## Solution 3

To convert to time_t (unix time)

http://msdn.microsoft.com/en-us/library/w4ddyt9h(v=vs.80).aspx[^]

```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:

## 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.
v2

Top Experts
Last 24hrsThis month
 John Simmons / outlaw programmer 239 OriginalGriff 230 ppolymorphe 125 Arthur V. Ratz 85 Mohtshm Zubair 50
 OriginalGriff 942 ppolymorphe 444 John Simmons / outlaw programmer 359 CPallini 303 Richard MacCutchan 242