Hi all,
I'm trying to achieve the above so that a time field will only display as 9:32AM as opposed to 9:32:46AM, thus removing the seconds and only showing the hours and minutes.
I've looked at modifying the dataFormats.cfg file but can't seem to locate the seconds variable. I guess %i is set to show both minutes and seconds.
I would also like to remove the seconds from the timer popup on the form.
Can anyone please point me in the right direction?
Cheers,
Dazzy.
Remove Seconds from time
-
- AppGini Super Hero
- Posts: 336
- Joined: 2015-12-23 16:52
Re: Remove Seconds from time
Here's the reference for mysql DATE_FORMAT():
http://dev.mysql.com/doc/refman/5.7/en/ ... ate-format
The definitions in dataFormat.cfg are used to format the data when it is written to the database. They don't control how it is displayed or formatted during input. When the data is read back and displayed, however, the effects of the SQL formatting will usually be observed. This is especially true for strings and numbers.
Of course, since AppGini feeds dates and times into picker functions, and those override the effects of the SQL formatting.
So, where you really want to be looking is at the tablename-tv.js and tablename-dv.js files. There, you can put jquery (or straight javascript) code to alter the behavior of the pickers. Such as only inputting hours and minutes. Or date with month and day, sans year.
(I rarely use the data formats, precisely because they only alter the data as it is written to the database. And for that, I prefer to add code to tablename_before_insert/update.)
http://dev.mysql.com/doc/refman/5.7/en/ ... ate-format
The definitions in dataFormat.cfg are used to format the data when it is written to the database. They don't control how it is displayed or formatted during input. When the data is read back and displayed, however, the effects of the SQL formatting will usually be observed. This is especially true for strings and numbers.
Of course, since AppGini feeds dates and times into picker functions, and those override the effects of the SQL formatting.
So, where you really want to be looking is at the tablename-tv.js and tablename-dv.js files. There, you can put jquery (or straight javascript) code to alter the behavior of the pickers. Such as only inputting hours and minutes. Or date with month and day, sans year.
(I rarely use the data formats, precisely because they only alter the data as it is written to the database. And for that, I prefer to add code to tablename_before_insert/update.)
Re: Remove Seconds from time
Quickfix : simply change from ".timepicker({ showSeconds: true," to ".timepicker({ showSeconds: false," in [database]_dml.php files ...
Regards
Regards
-
- Veteran Member
- Posts: 47
- Joined: 2016-08-28 10:37
Re: Remove Seconds from time
Thanks Pepemont - works a treat!
Re: Remove Seconds from time
Was looking for this, but found a better solution:
Add the following to dv function in the hook file!
Add the following to dv function in the hook file!
Code: Select all
$html = str_replace('showSeconds: true', 'showSeconds: false', $html);
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper