Questions tagged [datetime]

DateTime objects provide information about a given date/time.

16 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
0 answers
70 views

How to search/filter in CP by date range?

Is there a way in the control panel to list all entries with a date field between two dates? For example, last updated between 12/16/2019 and 2/15/2020. Interested in doing this for both automatic ...
user avatar
2 votes
0 answers
351 views

Order entries by custom date field

I want to modify this query so that the dated entries are sorted in descending order on a custom field called 'startDate'. Have tried adding .order('startDate') to the end of the craft.entries(query)....
user avatar
2 votes
0 answers
91 views

Timezone drama for events calendar

Working on site where there is events calendar of conferences and webinars. Users are (literally) all over the world. Trying to figure out how I am going to handle time zones. Factors: - Fields I am ...
user avatar
  • 41
2 votes
0 answers
330 views

Setting a date range on entry parameters

I'm working on a site that uses a date slider to select members of the site by birthdate. I want to show the users by gender and between two "ages". For example: Male, between 40 and 50 years old. The ...
user avatar
  • 363
1 vote
0 answers
24 views

Craft 2 - Date Comparison In Criteria - Impossible to access an attribute ("today") on a string variable (">=")

I am working with a template in Craft 2, and I am setting up the criteria for entries to be displayed. Here is my code (below). {% set today = now|date('Y-m-d') %} {% set criteria = { section: '...
user avatar
  • 368
1 vote
1 answer
104 views

How can I change the Date Created for Assets?

I'm using graphql to pull in some assets/pdfs and ordering them by dateCreated, however the files go back a few years (i.e. files from 2019, files from 2018 etc.) but they weren't uploaded in the ...
user avatar
  • 11
1 vote
0 answers
70 views

Archiving by month and year - timezone could not be found error

Following the answer in this thread -Linking and showing archive by month by P&T has worked fine for previous sites but now I'm getting the following error. I've checked I have a Time zone ...
user avatar
  • 879
1 vote
0 answers
135 views

How to create an archive dropdown menu

How do I create a dropdown menu that filters all the posts into month and year, and then link to a template that has the entries of that month and year displayed? This is as far as I've gotten: <...
user avatar
  • 11
1 vote
0 answers
48 views

DateTime is null in Live Preview

I made a custom field type (two datetime fields for starting / ending time). They have the good value when I loop in value in an entry, but have null value in Live Preview. Do you have an idea of what ...
user avatar
  • 21
1 vote
0 answers
89 views

forms.timeField not respecting time zone

I have a plugin that uses a datetime variable to record a class start time. When I save the training record the time is changed from local MDT to GMT into the database, and when displayed again it is ...
user avatar
0 votes
0 answers
12 views

Can't change author and dateCreated/postDate on duplicate entry action in Control Panel

We have a Craft-based email campaign builder that is up to date with Craft 3.7.x and plugins. I have a business logic plugin that works for a lot of custom functions but I can't seem to get this going....
user avatar
0 votes
0 answers
27 views

Sort Entry Array by date in Matrix Block

Goal I am listing theater plays. Each play has multiple show dates and corresponding places for each date. Each date & place combination is recorded in a matrix block (matrix field handle: shows), ...
user avatar
  • 11
0 votes
0 answers
224 views

SQLSTATE[HY000]: General error: 1525 Incorrect DATETIME value: ''

My website is running on Fortrabbit with the following settings: PHP version 7.4.15 OS version Linux 4.15.0-50-generic Database driver & version MySQL 8.0.23 Image driver & version Imagick ...
user avatar
0 votes
0 answers
78 views

How to automatically set time in a date/time field?

For a specific kind of entry I need the time in a date/time field to either automatically display as 23:00/11pm on the user dashboard, or, permanently set the time on that date/time field to 23:00/...
user avatar
0 votes
0 answers
98 views

Date Field Validation by PHP plugin

I have a form for updating user info, with a field of birth date. However, I am struggling to develop a validation for this date field by PHP. Its frontend code is this; {% set tz = craft.app....
user avatar
  • 389
0 votes
0 answers
153 views

Updating `{{ forms.dateField }}` value from GET variable

I want to use the built-in Craft field macros to show a date field in a plugin template for filtering. I can retrieve the submitted value on any submission (via GET) but how do I then prepopulate ...
user avatar
  • 1,721