sec2days(3f) - [M_time:DURATION] convert seconds to string of form dd-hh:mm:ss (LICENSE:MIT)
Synopsis
Description
Options
Returns
Example
Author
License
function sec2days(seconds,crop) result(dhms)
real(kind=realtime),intent(in) :: seconds or integer,intent(in) :: seconds or real,intent(in) :: seconds or character(len=*) :: secondslogical,intent(in),optional :: crop character(len=:),allocatable :: dhms
Given a number of seconds convert it to a string of the form
dd-hh:mm:sswhere dd is days, hh hours, mm minutes and ss seconds.
seconds number of seconds to convert to string of form dd-hh:mm:ss. May be of type INTEGER, REAL, REAL(KIND=REALTIME), or CHARACTER. CHARACTER strings may be of the form [NNd][NNh][NNm][NNs][NNw]. Case,spaces and underscores are ignored. Allowed aliases for d,h,m, and s units are
d - days,day m - minutes,minute,min h - hours,hour,hrs,hr s - seconds,second,secThe numeric values may represent floating point numbers.
crop if .true., remove leading zero day values or day and hour values. Optional, defaults to .false. .
dmhs the returned string of form [d:h:]m:s
Sample Program:
program demo_sec2days use M_time, only : sec2days implicit none integer,parameter :: dp=kind(0.0d0) write(*,*)sec2days(129860) write(*,*)sec2days(80000.0_dp) write(*,*)sec2days(80000.0,crop=.true.) write(*,*)sec2days(1 day 2.0hr 100 min 300.0seconds) end program demo_sec2daysresults:
1-12:04:20 0-22:13:20 22:13:20 1-03:45:00
John S. Urban, 2015
Nemo Release 3.1 | sec2days (3) | February 23, 2025 |