| Index
» Projekty
» phpMyEdit
» Fórum
» date and time fields |
 |
nepto
Založený: 06.01.2003
Príspevky: 320
Bydlisko: Phoenix, Arizona (USA)
Zaslal: 2004-01-16 13:01
Návrat hore
Odpovedať s citátom
|
The problem is, that is it difficult to determine from UNIX timestamp if time is 00:00...
_________________ Ondrej Jombik (Nepto)
Visit my
homepage
, review my recent
CV
or
projects
and give me some
feedback
.
|
hbernard
Založený: 23.03.2003
Príspevky: 159
Bydlisko: FRANCE
Zaslal: 2004-01-16 13:54
Návrat hore
Odpovedať s citátom
|
| Doug Hockinson Napísal: |
| Recent changes to the CVS class file that prevent null or empty dates from being displayed as 1969-12-31 or 1970-01-01 are really good. Can we have something similar for TIME fields to suppress dislpay of '00:00:00'? Maybe also for DATETIME and/or other time fields. Or maybe there is some hack that can be disclosed to accomplish this. Thanks. |
Maybe you could use manual sql datemask handling for a quick hack ?
I mean, remove 'timemask' options and use sql funcs with a if statement to display it your way.
|
ajh
Založený: 17.12.2003
Príspevky: 236
Zaslal: 2004-01-16 20:58
Návrat hore
Odpovedať s citátom
|
Isn't this what null values should be used for? If the value in the database is actually 00:00:00 then this means midnight, if it's null then there's no value.
So couldn't you then use [sql] to test whether the field is actually null and set it to '' if null and the actual value if not:
...['sql'] = 'IF(field IS NULL, "", field)'
Similarly if the field is blank on write, use [sqlw] to set it to null, otherwise set it to the value in the field.
...['sqlw'] = 'IF($val = "", NULL, $val)'
Of course, there is an argument that says null handling should be built in to PME.
Dates are different as 00/00/00 is never a valid date (although I guess that nulls are still the best way of doing it).
|
hbernard
Založený: 23.03.2003
Príspevky: 159
Bydlisko: FRANCE
Zaslal: 2004-01-23 22:07
Návrat hore
Odpovedať s citátom
|
| Doug Hockinson Napísal: |
It should be noted that the following appears to prevent adding or changing 'start_time' values. Thus it should only be used (for example) for publicly displayed forms (and not within the form where values are added, changed, etc.).
| Kód: |
$opts['fdd']['start_time']['sql|L']
= 'if(start_time = "00:00:00", "", start_time)'; |
|
It should not. If 'sql' isn't working in AC mode (freeing the null or zero field in Change mode in your example), then it is certainlly a bug.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|