Add this to your Podfile.
pod 'KPTimeAgo'
Just Drag and drop KPTimeAgo to your project.
First Step - import KPTimeAgo
to your project
let timeAgo = (Date().formatDateAsTimeAgo())
print(timeAgo)
//Just now
Other Example
//August 25 at 10:30 AM
//July 25
//September 25
//July 25, 2022
//October 25
//July 25, 2023
Custom date format
let timeAgo = KPTimeAgo.init(date: self.dateForComponents { $0.year = +6 }!, yesterdayFormat: nil, lastWeekFormat: nil, lastMonthFormat: nil, otherFormat: "LLLL d, yyyy")
print(timeAgo.formatDateAsTimeAgo()) //August 9, 2026
Feel free to collaborate with ideas, issues and/or pull requests.
- Parth (https://github.com/parth0072)
- Twitter: @kshatriya_parth
- Email : Parth
KPTimeAgo is released under the MIT License.