# Issues with dates and timestamps in Specify 7 query

**URL:** <https://speciforum.org/t/issues-with-dates-and-timestamps-in-specify-7-query/1538>\
**Category:** Get Help\
**Created:** [February 5, 2024, 2:44am UTC](https://speciforum.org/t/issues-with-dates-and-timestamps-in-specify-7-query/1538 "2024-02-05T02:44:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NielsKlazenga](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@NielsKlazenga](https://speciforum.org/u/NielsKlazenga)\
**Post date:** [February 5, 2024, 2:44am UTC](https://speciforum.org/t/issues-with-dates-and-timestamps-in-specify-7-query/1538/1 "2024-02-05T02:44:27Z")

</div>

We have started using the labels that can be produced from within Specify for our cryptogam packets at the end of last year. While in test, this worked exceptionally well in Specify 7, but now that it is in production, we encounter some issues, and differences with Specify 6, with how timestamps and dates are handled in the Specify 7 query.

People here like to print packets in the order they have databased the specimens, so that it is easy matching up the specimen with the packet it needs to go in. So, we order the results of the label query by the `TimestampCreated` of the Collection Object. This works fine in Specify 6:

![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/d/d0367b7dcc772690151498c7b320308df29a639b.png)

but in Specify 7 the time part is stripped off the timestamp, so specimens that have been databased on the same day will come out in pretty much random order:

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/0/0c72f54d3460d1e6dbb3cbfd71c1b3d576abdfd1.png)

We generally print batches of 50 to 100 packets, so, if they are not in the right order, it makes for a much more time-consuming job to match up the packets and the specimens.

Another thing I noticed just this morning is that the Specify 7 query does not take the date precision in account when calculating `Month` and `Day` values. So, for a record with an `eventDate` of just ‘1876’, Specify 6 gives:

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/0/0f99e161b1ce63c37a3de518a5beffbcb9c51759.png)

and Specify 7 gives:

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/a/a2d07930e073cb7d0479ce595b908301c7c7f43f.png)

I only use the Day and Month fields because I thought I could not access the DatePrecision in the query and it turns out that I was wrong, so I can probably fix this myself. However, I thought I’d note the discrepancy between Specify 6 and 7. People might rely on the Month and/or Day fields to be blank to know that they are dealing with an incomplete date.

I hope these issues are reasonably easy to fix.

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [February 9, 2024, 7:35pm UTC](https://speciforum.org/t/issues-with-dates-and-timestamps-in-specify-7-query/1538/2 "2024-02-09T19:35:47Z")

</div>

Hi @NielsKlazenga,

Thanks for your post!

You’ve identified two areas of in need of improvement. To start, it is a known issue that ‘Timestamp’ fields do not return the time in addition to the date in Specify 7. This is part of a larger problem where Specify 7 does not support “time” functionality.

> <https://github.com/specify/specify7/issues/477>
>
> When timestamp modified is queried in 7, the query result only displays the date… and not the time. It displays both date and time in 6.

The second issue is a great point and something that we had not previously considered to my knowledge.

In the database, Specify stores the dates as `1/1/YYYY` when only the year is known and indicated to Specify 6 that the `1`s should be ignored based on the `DateFieldPrecision` value (for precise dates). Specify 7 has not had this logic implemented, therefore you are seeing the issue you described:

> <https://github.com/specify/specify7/issues/4503>
>
> \*\*Describe the bug\*\*
> \> Another thing I noticed just this morning is that the Sp…ecify 7 query does not take the date precision in account when calculating \`Month\` and \`Day\` values. So, for a record with an \`eventDate\` of just '1876', Specify 6 gives:
> \> 
> \> !\[image\](https://github.com/specify/specify7/assets/37256050/351d4ebb-b7ad-4ae7-9b9b-1528fdaab142)
> \> 
> \> and Specify 7 gives:
> \> 
> \> !\[image\](https://github.com/specify/specify7/assets/37256050/79655bf3-8756-4af7-92b0-366363f1301c)
> \> 
> \> I only use the Day and Month fields because I thought I could not access the DatePrecision in the query and it turns out that I was wrong, so I can probably fix this myself. However, I thought I'd note the discrepancy between Specify 6 and 7. People might rely on the Month and/or Day fields to be blank to know that they are dealing with an incomplete date.
> 
> \*\*To Reproduce\*\*
> Steps to reproduce the behavior:
> 
> 1. Build a query on a date field
> 2. Make sure the date is set to just a year
> 3. Query on 'Day', 'Month', and 'Year'
> 4. See that Day and Month return \`1\` instead of nothing
> 
> \*\*Expected behavior\*\*
> It should show no number, not \`1\`.
> 
> \*\*Reported By\*\*
> @nielsklazenga on the \[Speciforum\](https://speciforum.org/t/issues-with-dates-and-timestamps-in-specify-7-query/1538)

I think you’re absolutely right that some users may rely on the month and/or day fields being blank for their queries, reports, labels, etc.

Thank you again for taking the time to share these points with us! I hope these are relatively easy to solve as well.

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [August 16, 2025, 4:10am UTC](https://speciforum.org/t/issues-with-dates-and-timestamps-in-specify-7-query/1538/3 "2025-08-16T04:10:22Z")

</div>

Hi @NielsKlazenga,

Thank you again for your report!

In the [Specify 7.11.1 update](https://speciforum.org/t/specify-7-11-1-release-announcement/2723), we’ve resolved the issue with ‘Day’ and ‘Month’ fields erroneously reporting `1`!

We are working on a solution to the issue with time not being displayed for `TimestampCreated` and `TimestampModified` now, which I expect to arrive relatively soon:

> <https://github.com/specify/specify7/pull/7317>
>
> Fixes #477, built on top of the fix for #641 since we use the back end timezone …for timestamps
> 
> This PR puts the "time" in "timestamp" 🕐 
> 
> \*\*Before:\*\*
> \<img width="1585" height="581" alt="image" src="https://github.com/user-attachments/assets/3f8360ad-6f05-4692-b8ea-9fd5b46e355f" /\>
> 
> \*\*After:\*\*
> 
> \<img width="1582" height="709" alt="image" src="https://github.com/user-attachments/assets/f6ef3600-5ec1-4e50-8bec-9c01846ba174" /\>
> 
> 
> \### Checklist
> 
> \- \[X\] Self-review the PR after opening it to make sure the changes look good and
> self-explanatory (or properly documented)
> \- \[\] Add relevant issue to release milestone
> \- \[\] Add pr to documentation list
> \- \[\] Add automated tests
> \- \[\] Add a reverse migration if a migration is present in the PR
> 
> \### Testing instructions
> 
> \- \[\] Query on \`TimestampCreated\` and \`TimestampModified\`
> \- \[\] Verify that the time is now displayed in the query results
> \- \[\] Verify that sorting both ascending and descending order works appropriately
> \- \[\] Test all supported query operators and verify the behavior is consistent
