Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [datetime]

Use it for questions about handling date or time through any module. Don't use it if you are already using "calendar" as tag.

1
vote
2answers
40 views

Date vs Timestamp field-type

My new project involves the requirement of manually setting a time of creation of nodes because they're looking into manually migrating parts of their old website into their new one. The date will ...
0
votes
0answers
41 views

Why is a ISO:8601 date within a time tag converted to zeroes?

I've been attaching Timeago script to my themes and it requires dates to be formatted like this. <time class="timeago" datetime="2008-07-17T09:24:17Z">July 17, 2008</time> In a view, I ...
1
vote
1answer
34 views

Upon submitting a webform, set a date field on the article node equals to “current time” + “X minutes”

I am using the Field Timer module to display countdown timer on my article node. This module will take the value of the date/time field (my case: field_article_datetime) and convert it into a ...
1
vote
1answer
53 views

Set a date field equal to “current time” + “5 minutes” using tokens

I am using the Field Timer module to display countdown timer on my article node. Say my article node has the date/time field named (field_article_datetime) This module will take the value of the ...
1
vote
1answer
26 views

How to show the following n events with respect to the current date or the past events to always ensure n elements in the view?

I have an agenda on my homepage, and I want to always ensure 5 events. If there are 5 or more following events (including the current one), show the nearest 5 from the start date. If there is less, ...
0
votes
1answer
33 views

Serializing dates

In Drupal, we have the time printed as "2012-03-19 07:22". What I need is just "\/Date(1198908717056)\/" or just "1198908717056". I am trying to get that format using the following code. use Drupal\...
1
vote
1answer
28 views

Create Custom Date Formatter for Date Posted Field

I followed a very helpful article by Antonio Benitez that gave some example code showing how to create a custom date formatter for date fields (How To Create a Custom Format for a Date Field). The ...
1
vote
2answers
40 views

Control Webform's date field (datepicker) from JS

I have to change number of months that's shown in datepicker of my date field in Webform, on desktop I need 2 months, but on mobile just 1. I'm not able to control that using JS, so I created patch ...
0
votes
0answers
54 views

How to combine two date fields and alter its value programmatically based on field value?

I have two fields field_start_date and field_end_date and under manage display section I have set the field format for field_start_date as F d field_end_date as - d Y I need to combine the two fields ...
0
votes
1answer
39 views

Let customers set appointments while showing me their country time and my country time in contact form output [closed]

I'd like to create a form in which a customer will insert basic details like name, email and so forth but will also schedule a specific date and time in an appointment scheduling system, adjusted to ...
0
votes
1answer
19 views

Datelist element in webform not working

I was just going through webform configurations and I changed the date list element format from default to raw. After doing this Im not able to add any element of type dateform to my webform and also ...
1
vote
0answers
23 views

How do I access datetime field formatter node values?

The DateTimeFormatterBase class is performing a ->setTimeZone incorrectly for my use case. How do I access the node values from where the $date passed to setTimeZone originated? Strange question I ...
0
votes
0answers
11 views

Copy Field Collection Data to Date Range Fields?

When our Drupal 8 website launched we used the Field Collection module so that some content types could store two or more dates for calculating a range, something not then supported on the platform. ...
0
votes
1answer
17 views

Display the exclude dates on a node

I have a Drupal 7 site with a content type called Weekly Repeating Event, and events of this type repeat at the same time and day each week. I use a custom template file to display this node type by ...
0
votes
1answer
115 views

How to print “Time” field in twig template

I have a time field in my content type. But when I entered time in the format 05:00 AM, I get a five digit timestamp eg. 18000 (for 05:00 AM). When I print this using node.field_time.value|date('h:i ...
0
votes
0answers
27 views

Need system wide time zone calculation ability

I need to hook into the time zone pipeline before date display to properly calculate "local" time events. It seems Drupal provides site and user time zone settings (and Views has its own TZ control ...
6
votes
2answers
547 views

My Date in Twig is ignoring format

I have a twig file with the following code in my Drupal 8.4.4 site: <div class="value col-md-12">{{ node.field_date.value }}</div> And in my content type, manage display option, I have ...
1
vote
1answer
65 views

Update the date field to the date & time of the node being updated

I am sure that I am missing something very simple here, so I hope somebody can put me on the right track. Use Case: I have a simple content type "Article" A date field of type: "Date and Time" is ...
1
vote
1answer
37 views

View date filter using years as an offset

Is there a way to use years as a date filter offset? What I want is to set it so that it it loads all content from the start of the previous year. So >= 01-01-2017 this year, >= 01-01-2018 next year, ...
1
vote
0answers
39 views

How to set a default date when extending DateRangeItem FieldType plugin

I created a new field type plugin that extends DateRangeItem. My plugin only adds some more settings. I also created an own widget that extends DateRangeWidgetBase. My formElement function looks like ...
1
vote
1answer
67 views

Date/Time +1h in Node

I have a module to import nodes with a date/time field. All times are correctly written into the database. But when I view a node or in node/edit I get the time +1 h. In Drupal I have set the timezone ...
0
votes
1answer
283 views

Views filter criteria date field is greater than current date

I have a overview page with different events. Now it shows all events which were created. But I will that it just shows all the future events. The content type has a datefield for the eventdate. I ...
0
votes
1answer
17 views

Show content with a date after the current one on a view

I'm creating a calendar of events with Drupal 7 using views. At the moment the elements are shown in order of the date of each one (I have a date field where I put the date of the event). Now I need ...
0
votes
2answers
41 views

Insert date programatically in custom module

I am programatically saving values from an array $customer into a content type. The below code works fine and populates the content type customer_profile except for the field date of birth. This field ...
0
votes
1answer
39 views

Date popup field won't display in tableselect element

I am attempting to embed a couple of date fields within a tableselect element, and after trying to use both textfield and date_popup field types, I can't get either to work. Here's my form function ...
1
vote
1answer
131 views

How to programmatically set the user timezone

I am programmatically creating a user and wanted to assign a timezone for the user I am able to successfully create a user by the following code $user = \Drupal\user\Entity\User::create(); $user-&...
1
vote
1answer
32 views

Modify date popup structure

I would like to modify the date popup structure, in the image below you can see how date module builds the element. Drupal's default label is hidden, and it generates other to display the title. I ...
0
votes
1answer
94 views

How to add a time picker in datetime form elements

I have made a module that display a form. One of the form elements is a datetime field. $form['FirstDate'] = array( '#type' => 'datetime', '#title' => t('First date-time'), '#...
1
vote
2answers
66 views

Create a custom date format

Our organization's style guide expects dates in this format: Oct. 31 2018 01:30 p.m. I looked the date format drop-down in our views, and there were several options, including a custom one. ...
1
vote
1answer
23 views

Get all the machine names of the date formats

I have searched the Drupal documentation but until now I have not found the way to obtain the machine names of the date formats that the user creates from the Drupal administration. They would be the ...
0
votes
0answers
24 views

Why does changing date portion of a datetime string on node presave subtract an hour from the time portion?

I have two date fields, one only accepts date input and the other is only accepting time input (via the technique where you set the ['#date_date_element'] = 'none' as described in this answer). In ...
0
votes
0answers
18 views

Change date field; how to add timezone handling later

About date fields, this page https://www.drupal.org/node/767182 says If you start off without a time zone, but then realize that you need one at a later date [...] Perform the switch in the ...
1
vote
1answer
25 views

Get all nodes where date field matches month and year

I have a content type with a date field (myFieldDate) whose values are timestamps. (I'm collecting only day, month, and year.) I have a custom form where I have a select list to select month and year....
0
votes
0answers
18 views

How can I format a date in 12 hour format?

I have tried all of the suggestions I can find but can't get the date module to display dates in 12 hour format. I have tried to use a custom date format with "h i" but no matter what I do dates are ...
0
votes
1answer
127 views

Import date field with feeds

I have a csv with a Date field that contains the date in one of the following formats: dd/mm/yy (ex. 13/11/04) dd/mm/yyyy (ex. 13/11/2004) I need to import these dates to my field in the format dd-...
0
votes
1answer
137 views

How can I get translation for a field of custom date

I am using the paragraphs module. I have a field which contains a date and time e.g. for events, which is added by an author. For the output I use a paragraph-twig-file and I have this: <div class=...
0
votes
1answer
401 views

Migration Source YML File import date string into date and time field of content type

I have a json file full of data exported from a wordpress site, one field being a string representing a date and time: "03/15/2012 14:46:19". I would like to import that string into a date and time ...
1
vote
1answer
74 views

How to retrieve value of start date with format end date?

I D8 installed the module Optional End Date in order to add an optional end date within a date field. When I had a single date field value I could get the value by using: $datum_deelname = $node-&...
0
votes
1answer
126 views

entityQuery with multivalue date field

Is there way to use entityQuery in order to select nodes with multiple value date field. For example we have a content type event with a field field_event_date which may contain unlimited number of ...
0
votes
1answer
153 views

Change the format of 'Authored on' date in views filter

In Drupal 8, I want to remove the timestamp on 'Authored on' date in views filter. Any Idea how to do this?
0
votes
1answer
148 views

Use created year as condition in Entity Query

I'm performing an entity query that searches for nodes of my custom content type called 'news'. I want to perform the query in a way that only produces the 'news' nodes that have a Authored Date that ...
0
votes
0answers
97 views

Settings and otions for Single Date Time Picker module

in my form I have decided to use Single Date Time Picker module since it gives a way to edit options of datepicker field via jQuery option list and it is also a time picker. So I added my custom ...
1
vote
1answer
33 views

How do you render a Node's Last Saved date in a Region Footer (ie, inside a Block on every page)?

I'm new to Drupal (8) and have no PHP experience, but I've managed to get this interesting CMS doing just about everything I need by playing with Twigs. I cannot for the life of me figure out how to ...
0
votes
0answers
20 views

Rules “Schedule component evaluation” not apply actions of component

I have the a Drupal site with enabled modules: Rules, Rules Scheduler Privatemsg & all submodules Date & all submodules Flag I created a content type "Event" with a date field (popup) and ...
0
votes
2answers
54 views

Partial start date with end date output views

I'm using views to output a list of nodes with dates. Some node dates have both a start and end date inserted. If both a start and end date exists, i would like the date to be outputted only taking ...
0
votes
1answer
240 views

How to convert a timestamp field into a date field?

Is there a way to convert the data of a timestamp field into a regular date field in Drupal 8? preferably without coding or making a new module.
0
votes
1answer
71 views

EntityQuery how to get all delta and good for field_dates

I've got these dates linked to a node. I just want to make a request to render all node when time() is between field_date_value AND field_date_end_value OR time() is < to field_date_value (ps: ...
0
votes
0answers
89 views

How do I convert a timestamp field to a date field?

After migrating about 34k nodes, I realized that this type of field is not compatible with the view exposed filters because it doesn't show the select date popup when it's exposed. I prefer not to ask ...
1
vote
0answers
51 views

How to remove the word “ago”? [closed]

I use Drupal 8 in French and I have never managed to delete the word "ago" which means nothing in French. How to remove the word "ago" in drupal 8? When I created a duration since, drupal added "ago"...
1
vote
2answers
1k views

Webform date field format

How do I change the date format of a date field in WEBFORM? I have enabled popup calendar for this field, and when I select a date from the calendar, the default format is in Y-m-d which I want to ...