<p>Craft stores dates in the database in the following format:</p>

<pre><code>Y-m-d H:i:s
</code></pre>

<p>So submitting the date in this format should work, for example:</p>

<pre><code>2014-06-24 23:30:00
</code></pre>

<p>It should also be possible to split the date and time into individual fields as follows:</p>

<pre class="lang-twig prettyprint-override"><code>&lt;input type="text" name="fields[customFieldName][date]" value="2014-06-24" /&gt;
&lt;input type="text" name="fields[customFieldName][time]" value="23:30:00" /&gt;
</code></pre>

CC BY-SA 3.0
2017-07-07T07:50:58.877Z
I've tried this with the split fields, and they do not work - nothing is stored in the date-time field in the back end. If I take the same values and mung them into one input (following your example: `<input type="text" name="fields[customFieldName]" value="2014-06-24 23:30:00" />`) then it does work. Is this a bug I've found?
Matt Wilcox
CC BY-SA 4.0
2018-06-05T23:04:44.593Z
Note, the format can vary between locales (apparently). See this Straight Up Craft post for an alternate syntax... https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input
Lindsey D
CC BY-SA 3.0
2014-06-25T16:21:35.983Z
2016-02-25T17:44:30.093Z
2016-02-25T17:44:30.093Z
Ben Croker
<p>Currently using a date picker to select a date and submit it on user registration, formatted as <strong>m/d/Y</strong>, have played with various formats but can't one that works. </p>

<p>Any ideas?</p>

CC BY-SA 3.0
2014-06-25T14:50:44.837Z
Where exactly are you trying to save this date to? Can you please expand on what it is you are trying to achieve?
Ben Croker
CC BY-SA 3.0
2014-06-25T15:26:47.157Z
This is just the standard front end user registration (based on the example in craft docs) with a couple of custom fields. All is working fine until I add a custom date field to the reg form, working on the assumption it fails on format. So i need to make sure that the input / post formats the date correctly.
Sam Hibberd
<users><datetime>
How do you format a date for saving with users/saveUser on the front end?
# How do you format a date for saving with users/saveUser on the front end?

(Asked by: username_0 on 2014-06-25)

Currently using a date picker to select a date and submit it on user registration, formatted as **m/d/Y**, have played with various formats but can't one that works.

Any ideas?

**Tags:** users, datetime
> **Comments:**
> **username_1**: Where exactly are you trying to save this date to? Can you please expand on what it is you are trying to achieve?  
> **username_0**: This is just the standard front end user registration (based on the example in craft docs) with a couple of custom fields. All is working fine until I add a custom date field to the reg form, working on the assumption it fails on format. So i need to make sure that the input / post formats the date correctly.  

---

## 1 answers

### Answer by username_1 on 2014-06-25. Score: 8 | Accepted answer

Craft stores dates in the database in the following format:
Y-m-d H:i:s

So submitting the date in this format should work, for example:
2014-06-24 23:30:00

It should also be possible to split the date and time into individual fields as follows:

> **Comments:**
> **username_2**: I've tried this with the split fields, and they do not work - nothing is stored in the date-time field in the back end. If I take the same values and mung them into one input (following your example: `<input type="text" name="fields[customFieldName]" value="2014-06-24 23:30:00" />`) then it does work. Is this a bug I've found?  
> **username_3**: Note, the format can vary between locales (apparently). See this Straight Up Craft post for an alternate syntax... https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input  

---

