<p>You're getting that error because <code>Do., 07 Sep. 2017 10:32:05</code> isn't in a valid PHP <a href="https://secure.php.net/manual/en/datetime.formats.php" rel="nofollow noreferrer">Date/Time format</a> when you pass it into the <code>|date</code> filter.</p>

<p>Changing it to <code>07 Sep. 2017 10:32:05</code> should work.</p>

CC BY-SA 3.0
2017-09-11T09:08:58.460Z
But that means the `latestSubmission` tag which gets it's data from the am forms plugin saves the date in the wrong formate in the db? since there is no manipulaiton on my side ??? Or ist this a server config thing?
KSPR
CC BY-SA 3.0
2017-09-11T19:02:14.990Z
I'd guess it's an plugin issue, but not 100% sure.
Brad Bell
CC BY-SA 3.0
2017-09-13T12:32:37.933Z
I'll check back with the plugin dev
KSPR
CC BY-SA 3.0
2017-12-06T17:40:13.880Z
`c` is valid format for the `date()` function, it outputs in ISO8601 http://php.net/manual/en/function.date.php
carlcs
CC BY-SA 3.0
2017-12-07T04:24:42.580Z
@carlcs oops... my bad!
Brad Bell
CC BY-SA 3.0
2017-12-07T11:27:13.170Z
The plugin dev hasn't answered on my github ticket so far 
KSPR
CC BY-SA 3.0
2017-09-07T14:34:03.623Z
2017-12-07T04:24:34.087Z
2017-12-07T04:24:34.087Z
Brad Bell
<p>I want to get the lates <code>postDate</code> of a List and format it for the <code>cache</code> tag</p>

<pre><code>{% set latestSubmission = craft.amForms.submissions(
    { formHandle: 'reservation', order: 'dateCreated desc' }).datum('&gt;= '~now).dateCreated().first()
%}

{{ latestSubmission }}
</code></pre>

<p>This Returns: </p>

<blockquote>
  <p>Do., 07 Sep. 2017 10:32:05</p>
</blockquote>

<p>But I want to pass it into the Cache Tag so I want to format it and write:</p>

<p><code>{{ latestSubmission | date('c') }}</code></p>

<p>This returns the error:</p>

<blockquote>
  <p>DateTime::__construct(): Failed to parse time string (Do., 07 Sep. 2017 10:32:05) at position 0 (D): The timezone could not be found in the database</p>
</blockquote>

<p>Why? Why can’t I reformat it when it is already returning a date?</p>

<datetime><postdate><plugin-amforms>
DateTime::__construct(): Failed to parse time string
# DateTime::__construct(): Failed to parse time string

(Asked by: username_0 on 2017-09-07)

I want to get the lates postDate of a List and format it for the cache tag
{% set latestSubmission = craft.amForms.submissions(
    { formHandle: 'reservation', order: 'dateCreated desc' }).datum('>= '~now).dateCreated().first()
%}

{{ latestSubmission }}

This Returns: 

Do., 07 Sep. 2017 10:32:05

But I want to pass it into the Cache Tag so I want to format it and write:
{{ latestSubmission | date('c') }}
This returns the error:

DateTime::__construct(): Failed to parse time string (Do., 07 Sep. 2017 10:32:05) at position 0 (D): The timezone could not be found in the database

Why? Why can’t I reformat it when it is already returning a date?

**Tags:** datetime, postdate, plugin-amforms

---

## 1 answers

### Answer by username_1 on 2017-09-07. Score: 1 | Accepted answer

You're getting that error because `Do., 07 Sep. 2017 10:32:05` isn't in a valid PHP [Date/Time format](https://secure.php.net/manual/en/datetime.formats.php) when you pass it into the `|date` filter.

Changing it to `07 Sep. 2017 10:32:05` should work.

> **Comments:**
> **username_0**: But that means the `latestSubmission` tag which gets it's data from the am forms plugin saves the date in the wrong formate in the db? since there is no manipulaiton on my side ??? Or ist this a server config thing?  
> **username_1**: I'd guess it's an plugin issue, but not 100% sure.  
> **username_0**: I'll check back with the plugin dev  
> **username_2**: `c` is valid format for the `date()` function, it outputs in ISO8601 http://php.net/manual/en/function.date.php  
> **username_1**: @carlcs oops... my bad!  
> **username_0**: The plugin dev hasn't answered on my github ticket so far   

---

