Forums

How to change a datesyntax in a form

hyperful 09 Feb, 2018
Hi there,

I have a question regarding dynamic data.
let's say you have a value in your database of a date in syntax: YYYYMMDD
Is it possible, when you load the value via dynamic data, you change something on the syntax, that for example you can show it DD-MM-YYYY or DDMMYYYY
Thanks in advance!
GreyHead 09 Feb, 2018
Hi hyperful,

You can do this using a Custom Code action before the HTML Render Form action. See this StackOverFlow answer for some ways to do this e.g. something like this:
<?php
$form->data['date'] = date('d M Y', strtotime($form->data['date']));
?>
Bob
This topic is locked and no more replies can be posted.