Skip to content

DateInterval add possibility to have the result in hours, minutes, seconds #16548

Open
@devbysb

Description

@devbysb

Hi,

is it possible to have the result of a DateInterval in numbers of hours, minutes, seconds like this

Example you have a DateInterval with 48hours

(\DateInterval::createFromDateString('2 days'))->h  // result 0 
(\DateInterval::createFromDateString('2 days'))->totalHours  // result 48
(\DateInterval::createFromDateString('2 days'))->totalMinutes // result 2880
(\DateInterval::createFromDateString('2 days'))->totalSeconds // result 172800

because if I do calculations on working hours for example it's easier for users to understand 48h00 instead of 2days 00h 00minutes and if I have to redo calculations and I need the hours, I have to reconvert the 2 days in hours and add them to the hours...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions