T
T
Tikhon Ermakov2020-08-04 22:20:14
Laravel
Tikhon Ermakov, 2020-08-04 22:20:14

How to properly store data and process it?

Good evening!

I want to implement duration time of video or music for example.

In the database, I will store the duration in seconds in the big integer type . So it was decided, since my application is multilingual.

Question about processing before returning data to the end client.
For example, does Carbon have a method to get from the number of seconds - minutes of a second or hour of a minute of a second ?

How to implement it correctly?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Daria Motorina, 2020-08-04
@the_goldmayer

CarbonInterval::seconds($secondsAsBigint)->cascade()->forHumans();

Example source on SO
There is no direct link to the Carbon doc, but this thing is described there)

A
Alexander, 2015-02-26
@jDeuterium

foreach ($array as $key => $val) {
    if(is_array($val)) {
    sort($array[$key]);
  }
}

A
Alexey Yakhnenko, 2015-02-26
@ayahnenko

what have you tried, what doesn't work?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question