'Given a start time of a slot in 12hrs time format (say "2: 45 PM") and a period in mins after this ends 15 for eg. How would you calculate end time?

I have a date slot in string (12hrs) format eg - "2:45 PM" and a time period to when this slot ends say 15 (mins). So time slots starts at "2: 45 PM" and ends in 15 mins. I want to show the ending time in the same format as time string in 12hrs format.

Example - Slot: "2: 45 PM", ends: 15 endingSlot will be "3: 00 PM"



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source