Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread DateTime manipulation
Thu, Jun 13 2013 1:07 PMPermanent Link

Matthew Jones

The help says "Date/time types are actually just 32-bit integers, so they can be
manipulated just like the Integer type."

This does not appear to be consistent. I am trying to get yesterday's date, using:
DayOf(tmToday - 1) but I get an error "Expected integer or float but insteadl found
tmToday". If I make that a + insteard, it compiles without problem. (I realise that
I probably have to make that a day's worth of milliseconds, but that needs basic
math to work on dates.)

Any suggestions welcome.

/Matthew Jones/
Thu, Jun 13 2013 5:46 PMPermanent Link

Walter Matte

Tactical Business Corporation

>>Any suggestions welcome.

See my  Julian Date Post

http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&msg=2471


In use:

var
 wd : DateTime;
 curwd : integer;

......

 wd := Date;

 curwd := DateToJul(wd);

 while ((curwd - dref) mod 14) <> 0 do
 begin
   curwd := curwd - 1;
 end;
 gbPeriodStartDate := JulToDate(curwd);

 gbPeriodEndDate   := JulToDate(curwd + 13);


Walter
Fri, Jun 14 2013 7:04 AMPermanent Link

Matthew Jones

Many thanks. I have added those routines to my code. I had to go look up Julian
dates, given that in all my years of programming I've never had to use them before,
thus didn't learn them. But they are of course ideal for this, and I now have my
friendly date routines working.

/Matthew Jones/
Fri, Jun 14 2013 2:10 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< This does not appear to be consistent. I am trying to get yesterday's
date, using: DayOf(tmToday - 1) but I get an error "Expected integer or
float but insteadl found tmToday". If I make that a + insteard, it compiles
without problem. (I realise that I probably have to make that a day's worth
of milliseconds, but that needs basic math to work on dates.) >>

This is now fixed.  For now, just cast the tmToday as an Integer.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Aug 6 2013 9:41 AMPermanent Link

Matthew Jones

Tim,

tmTimeToRefresh := m_tmNextRefreshTime - Integer(tmNow);

I cannot subtract one time from another either. Or add two times.
Both would be handy.

/Matthew Jones/
Tue, Aug 6 2013 12:10 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I cannot subtract one time from another either. Or add two times. Both
would be handy. >>

Noted.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Image