MikeCouling
New member
- Local time
- Today, 10:05
- Joined
- Feb 14, 2020
- Messages
- 7
I'm processing moth records and am intereted in the earliest & latest appearnces of each species. I'm getting a problem when formatting the date - it seems to subtract a day. I'm using the following SQL :-
SELECT
Taxa.Taxon,
Records.Date,
Format([Date],"ddmmmyyyy") AS RecordDate,
DatePart("y",[date]) AS DayOfYear,
Format(DatePart("y",[date]),"mmmdd") AS DateOfYear
FROM Records INNER JOIN Taxa ON Records.[*Taxon] = Taxa.[_guk]
WHERE (((Taxa.Taxon)="Agriopis leucophaearia") AND ((Records.Date)=[dateto]))
ORDER BY DatePart("y",[date]);
This gives the following :-
Formatting the date seems to have subtracted 1 from its value. Could this be that the date is stored as a floating point number (it's a long integer in the Records table) and there's rounding going on, or am I over-thinking things.
Suggestions gratefully received.
SELECT
Taxa.Taxon,
Records.Date,
Format([Date],"ddmmmyyyy") AS RecordDate,
DatePart("y",[date]) AS DayOfYear,
Format(DatePart("y",[date]),"mmmdd") AS DateOfYear
FROM Records INNER JOIN Taxa ON Records.[*Taxon] = Taxa.[_guk]
WHERE (((Taxa.Taxon)="Agriopis leucophaearia") AND ((Records.Date)=[dateto]))
ORDER BY DatePart("y",[date]);
This gives the following :-
Formatting the date seems to have subtracted 1 from its value. Could this be that the date is stored as a floating point number (it's a long integer in the Records table) and there's rounding going on, or am I over-thinking things.
Suggestions gratefully received.