Pro only
Change the format of a generated dateBy default, dates in Fake Data are generated in the following format: 2016-07-10 04:20:00
.
Sometimes, this format may not satisfy your needs and you want to change it. Fake Data comes bundled with Moment.js library which has powerful formatting options.
In order to change the format of the date, please follow these steps:
- Open Fake Data's options page
- Go to Generators -> Default Generators tab
- Find the
datetime
generator, and click on the manage icon: - On the newly opened popup, under
Date & Time format
chooseUse Custom
- Once you enable that setting, you will be able to type the format that you want
- You can see the available formatter options on this page.
- For example, if you want a date in the format of "July 4th, 2022", then you would use
MMMM Do, YYYY
- When finished with the selection, press Done. Also make sure to save changes on the generators page.
TIP
When filling input elements that are of type date, datetime-local, time, month
, the format will always be enforced to an ISO 8601 standard (ex: 2022-07-14T14:37:12+00:00). This way, the browser will handle the date values properly for such inputs.
TIP
Doing the steps described above, will change the setting for all fields that are using the generator you updated. You can also change this setting only for a single field, either through the Fields page, or by clicking on the "Manage Field" option from the context menu.