https://antibiotiqueaugmentin.com/surdosage-augmentin-bebe/
× Welcome to the ToolsJX forum!


Converting date format before display

  • fredmccr
  • fredmccr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #3458

Hi,

My site has a form created by a component called "Visforms", which contains a date field with a format like YYYY-MM-DD. This is something that, for some reasons, I cannot change.
Nevertheless, I would like that Table JX displays this date in the table as DD-MM-YYYY. This is something that seems to have no native solution.

I was thinking of adding a short conversion with a php code like:

$newDate = date("d-m-Y", strtotime($date));
where $date is the original date provided by my form and $newDate the result after being converted.

Can you help me in finding which php file of Table JX I should hack ?

Thanks ;)

Please Log in or Create an account to join the conversation.

More
8 years 9 months ago #3459

Hi,

sure. Take a look at the for loop in components/com_grid/GridView.php, line 277. $column holds the field name, $podatek holds the data.

Please Log in or Create an account to join the conversation.

  • fredmccr
  • fredmccr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #3463

Thank you Tomaz for the advice. I checked the components/com_grid/layouts/GridView.php file and its loop starting at line 277.
I've spent a lot of time trying to intervene in the loop but I'm definitely not comfortable enough in coding and did not succeed in changing the date format.

I first started with this line

if ($column=F3) $newDate = date("d-m-Y", strtotime($podatek));
echo $newDate;
The column that holds the date is called "F3". "echo $newDate;" was just here to check the result of the conversion on the screen.

but "if ($column=F3)" is not taken into account.

Would you please help me in:
- fixing the code
- putting it at the right place in the loop ?

Thank you ;)

Please Log in or Create an account to join the conversation.

More
8 years 9 months ago #3464

Hi! Comparison operator in PHP is ==.
try
if ($column==F3) ...

;)

Please Log in or Create an account to join the conversation.

  • fredmccr
  • fredmccr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #3465

Doesn't work, even with == ...
I'm very close to give up ... and a bit desperate :unsure:

Please Log in or Create an account to join the conversation.

Moderators: tomaz
Time to create page: 0.207 seconds

Contact Us

Contact us on Discord

Contact us on Facebook