Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 11 total
Thread Days between two dateTimes?
Sun, Jun 11 2023 7:13 PMPermanent Link

Ian Branch

Avatar

Hi Team,
I need to get the number of whole days between two datetimes.
I thought this would give it to me but..
"select Cast(DateSent - DateTime Day as Integer) as iDays from APJobtickets"
DateSent and DateTime are both DateTimes.
I get this error.
"ElevateDB Error #700 An error was found in the statement at line 1 and column 33 (Expected AS or , but instead found Day)"

Help!

Regards & TIA,
Ian
Mon, Jun 12 2023 1:36 AMPermanent Link

Yusuf Zorlu

MicrotronX - Speditionssoftware vom Profi

Ian Branch wrote:

> Hi Team,
> I need to get the number of whole days between two datetimes.
> I thought this would give it to me but..
> "select Cast(DateSent - DateTime Day as Integer) as iDays from
> APJobtickets" DateSent and DateTime are both DateTimes.
> I get this error.
> "ElevateDB Error #700 An error was found in the statement at line 1
> and column 33 (Expected AS or , but instead found Day)"
>
> Help!
>
> Regards & TIA,
> Ian

Hi Ian,

"select cast("DateSend"-"Day" as integer) as iDays from APJobtickets"

should work.

Brgds, Yusuf
Mon, Jun 12 2023 2:14 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


select CAST ((DateSent - DateTime ) DAY AS INTEGER) as iDays from APJobtickets

If you just want it for display purposes and don't want to do arithmetic on individual rows (eg SUM will work)

select (DateSent - DateTime ) DAY as iDays from APJobtickets

I don't know if it rounds up or down or does bankers rounding so you'd need to test

Roy Lambert
Mon, Jun 12 2023 2:29 PMPermanent Link

Ian Branch

Avatar

Hi Roy,
Neither work.
I wonder if it is because I have a field called DateTime??

Ian
Tue, Jun 13 2023 2:16 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


Works here in EDBManager 2.35b3

Try putting DateTime in double quotes

Roy Lambert
Tue, Jun 13 2023 3:13 PMPermanent Link

Ian Branch

Avatar

Hi Roy,
Well that was interesting.
It didn't work for me.
On a whim I deleted edbmgr.ini and rebuilt the Database connection.
All good now.
Must have picked up some corruption somewhere/sometime.  Frown

Tks for your time & input.
Ian
Wed, Jun 14 2023 2:25 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


I have a small utility I wrote to go through the ini file and delete most of it (leaves session & EDB config information alone). If you want a copy I'll post source & exe to the binaries ng

Roy Lambert
Wed, Jun 14 2023 5:05 AMPermanent Link

Ian Branch

Avatar

Yes please & thank you.
Ian
Wed, Jun 14 2023 7:18 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


In binaries now as "Ini clean up"

Roy Lambert
Wed, Jun 14 2023 4:42 PMPermanent Link

Ian Branch

Avatar

Tks Roy,
All good.  Builds & Runs under D11.3.
Page 1 of 2Next Page »
Jump to Page:  1 2
Image