<p>Here's an example value that will set it to today:</p>
<pre><code>[
  'timezone' =&gt; 'America/New_York',
  'date' =&gt; date('m/d/Y')
]
</code></pre>
<p>As always, easiest to find out how it's done by inspecting the fields as they are saved in the control panel.</p>

CC BY-SA 4.0
2021-01-11T09:04:05.637Z
2021-01-11T09:04:05.637Z
Udo
<p>I'd like to set the value of a Date field from my custom PHP code.
How can this be made? Which format does the Date field expect when using the setValue() function?</p>

<datetime><custom-field>
How to set the value of a Date field from PHP?
# How to set the value of a Date field from PHP?

(Asked by: username_0 on 2021-01-10)

I'd like to set the value of a Date field from my custom PHP code.
How can this be made? Which format does the Date field expect when using the setValue() function?

**Tags:** datetime, custom-field


---

## 1 answers

### Answer by username_1 on 2021-01-11. Score: 2 | Accepted answer

Here's an example value that will set it to today:
[
  'timezone' => 'America/New_York',
  'date' => date('m/d/Y')
]

As always, easiest to find out how it's done by inspecting the fields as they are saved in the control panel.


---

