I have a view of a database that shows the cumulative hours each person has attended work in the month, so it is common for users to have 80:00:00 hours per month, but when I try to “echo” the value obtained from the database view, PHP insists on adding the hours to the current date, so it converts 80 hours into 3 days 8 hours and instead of printing 80:00:00 it prints a date of 3 days 8 hours in the future along with a warning:
Warning (2): DateTimeImmutable::modify(): Failed to parse time string (88:00:00) at position 0 (8): Unexpected character [COREsrcDatabaseTypeDateTimeType.php,
I have googled but all I have found is how to format dates in php, but I don’t want php touch my data, neither to use php “date funcionts/objects”, I just want to prevent PHP from damaging my data.
When I use a sql client, cumulative hours are correctly displayed from the query, why php can’t do such a simple thing?
Pedro Esquivel Sanchez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.