Hi,
I have a form that there are 2 date fields on that I assume are pulling the date format form the database as the standard Joomla date formats do not affect it. I have posted the entire code for default.php below.
I’ve done a fair bit of searching and have a basic understanding of the various arguments for date format, but as I know nothing about php I’m having problems as to where to put this code. The 2 fields are “order” and “due”. I click on the calendar for the date I want and the format it comes out as is YYYY-MM-DD. I want it as DD-MM-YYYY. Could anybody help me with what to put in and where to achieve this?
[php]<?php
/**
- @version 1.0.0
- @package com_jobs
- @copyright Copyright © 2013. All rights reserved.
- @license GNU General Public License version 2 or later; see LICENSE.txt
-
@author
*/
// no direct access
defined(’_JEXEC’) or die;
//Load admin language file
$lang = JFactory::getLanguage();
$lang->load(‘com_jobs’, JPATH_ADMINISTRATOR);
$canEdit = JFactory::getUser()->authorise(‘core.edit’, ‘com_jobs.’ . $this->item->id);
if (!$canEdit && JFactory::getUser()->authorise(‘core.edit.own’, ‘com_jobs’ . $this->item->id)) {
$canEdit = JFactory::getUser()->id == $this->item->created_by;
}
?>
<div class="item_fields">
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_CREATED_BY'); ?>:
<?php echo $this->item->created_by; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_ID'); ?>:
<?php echo $this->item->id; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_JOB_NUMBER'); ?>:
<?php echo $this->item->job_number; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_JOB_TITLE'); ?>:
<?php echo $this->item->job_title; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_CUSTOMER'); ?>:
<?php echo $this->item->customer; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_SITES'); ?>:
<?php echo $this->item->sites; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_ORDER'); ?>:
<?php echo $this->item->order; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_DUE'); ?>:
<?php echo $this->item->due; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_PO'); ?>:
<?php echo $this->item->po; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_JOB_DESCRIPTION'); ?>:
<?php echo $this->item->job_description; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_PROGRESS'); ?>:
<?php echo $this->item->progress; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_INVOICE'); ?>:
<?php echo $this->item->invoice; ?></li>
<li><?php echo JText::_('COM_JOBS_FORM_LBL_TASK_STATE'); ?>:
<?php echo $this->item->state; ?></li>
</ul>
</div>
<?php if($canEdit): ?>
<a href="<?php echo JRoute::_('index.php?option=com_jobs&task=task.edit&id='.$this->item->id); ?>"><?php echo JText::_("COM_JOBS_EDIT_ITEM"); ?></a>
<?php endif; ?>
<?php if(JFactory::getUser()->authorise('core.delete','com_jobs.task.'.$this->item->id)):
?>
<a href="javascript:document.getElementById('form-task-delete-<?php echo $this->item->id ?>').submit()"><?php echo JText::_("COM_JOBS_DELETE_ITEM"); ?></a>
<form id="form-task-delete-<?php echo $this->item->id; ?>" style="display:inline" action="<?php echo JRoute::_('index.php?option=com_jobs&task=task.remove'); ?>" method="post" class="form-validate" enctype="multipart/form-data">
<input type="hidden" name="jform[created_by]" value="<?php echo $this->item->created_by; ?>" />
<input type="hidden" name="jform[id]" value="<?php echo $this->item->id; ?>" />
<input type="hidden" name="jform[job_number]" value="<?php echo $this->item->job_number; ?>" />
<input type="hidden" name="jform[job_title]" value="<?php echo $this->item->job_title; ?>" />
<input type="hidden" name="jform[customer]" value="<?php echo $this->item->customer; ?>" />
<input type="hidden" name="jform[sites]" value="<?php echo $this->item->sites; ?>" />
<input type="hidden" name="jform[order]" value="<?php echo $this->item->order; ?>" />
<input type="hidden" name="jform[due]" value="<?php echo $this->item->due; ?>" />
<input type="hidden" name="jform[po]" value="<?php echo $this->item->po; ?>" />
<input type="hidden" name="jform[job_description]" value="<?php echo $this->item->job_description; ?>" />
<input type="hidden" name="jform[progress]" value="<?php echo $this->item->progress; ?>" />
<input type="hidden" name="jform[invoice]" value="<?php echo $this->item->invoice; ?>" />
<input type="hidden" name="jform[state]" value="<?php echo $this->item->state; ?>" />
<input type="hidden" name="option" value="com_jobs" />
<input type="hidden" name="task" value="task.remove" />
<?php echo JHtml::_('form.token'); ?>
</form>
<?php
endif;
?>
<?php
else:
echo JText::_('COM_JOBS_ITEM_NOT_LOADED');
endif;
?>[/php]