php - converting pacific time string to time -
i have time strings pt19h15m, pt10h, pt5m etc.
pt19h15m equals 19:15 pt10h equals 10:00 pt5m equals 00:05
i want convert each string usual time.
is there built-in method
those formatted iso 8601 durations, supported dateinterval
, has handy method format
.
so example:
echo (new dateinterval("pt19h15m"))->format("%h:%i");
will output:
19:15
note "pt" in them not stand pacific time. p stands period , indicates start of duration representation, while t indicates beginning of time portion - years, months, , such supported too, e.g. p2yt19h 2 years 19 hours.
Comments
Post a Comment