• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: 1 date field 2 different output formats?

1 date field 2 different output formats? 11 months 2 weeks ago #42762

Hello, is there any way to have 1 datefield and the ability to output this value in two different formats?

Example: The user gives a date (d-m-Y) which is used in different areas. But we need to add this date into an utm_campaign parameter where we use another dateformat (my) too.

User Input: 03-05-2023
Output 1: 03-05-23
Output 2: 0523

My ideas:

1. have 1 datefield and rewrite the output via javascript but resulting in inconsistent db values.
2. have 1 datefield and modify the date in the php script area (would be the best)
3. sync 2 datefields with different formats

Does anyone have an idea or better a solution for this scenario?

Thank you!
The administrator has disabled public write access.

1 date field 2 different output formats? 11 months 1 week ago #42765

Solution:
// Generate utm_campaign
$date = DateTime::createFromFormat('Y-m-d', $_POST['form']['start']);
$_POST['form']['utmcampaign'] = $_POST['form']['slug'] . "_" . $_POST['form']['utmsource'] . "_" . $_POST['form']['utmmedium'][0] . "_" . $_POST['form']['product'][0] . "_" . $date->format('my');
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!