Convert seconds to human readable string(s)

버전 1.6 (3.39 KB) 작성자: Rody Oldenhuis
Convert an amount of seconds to hours/days/weeks/etc.
다운로드 수: 2.2K
업데이트 날짜: 2020/5/2

편집자 메모: This file was selected as MATLAB Central Pick of the Week

This function converts a (usually large) amount of seconds to human-readable string. For example,
>> str = seconds2human(1463456.3)
str =
'About 2 weeks and 2 days.'
You may also call the function with a second input argument; either 'short' (the default) or 'full'. This determines the level of detail returned in the string:
>> str = seconds2human(1463456.3, 'full')
str =
'2 weeks, 2 days, 22 hours, 30 minutes, 56 seconds.'

The 'short' format returns only the two largest units of time.

Furthermore, [secs] may be an NxM-matrix, in which case the output is an NxM cell array of the corresponding strings.

인용 양식

Rody Oldenhuis (2024). Convert seconds to human readable string(s) (https://github.com/rodyo/FEX-seconds2human/releases/tag/v1.6), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2009b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

GitHub 디폴트 브랜치를 사용하는 버전은 다운로드할 수 없음

버전 게시됨 릴리스 정보
1.6

See release notes for this release on GitHub: https://github.com/rodyo/FEX-seconds2human/releases/tag/v1.6

1.5.0.0

Description update
[linked to Github]

1.4.0.0

- Added 'decennium' as a time unit
- Implemented more robust error-checking
- Small documentation update

1.3.0.0

Updated contact info

1.2.0.0

- reduced the default verbosity, as suggested by Jos. The verbosity can now be changed with a second argument.

- Included (sec < 1) case, as suggested by Jesse.

1.1.0.0

updated code thanks to Jos' comments.

1.0.0.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.