lnd-demo-app/wallet/Utils/Extensions/Date.swift

25 lines
676 B
Swift
Raw Normal View History

2023-06-08 06:36:06 +00:00
//
// Date.swift
// wallet
//
// Created by Adriana Epure on 24.08.2022.
// Copyright © 2022 Jason. All rights reserved.
//
import Foundation
extension Date{
func adding(minutes: Int) -> Date {
return Calendar.current.date(byAdding: .minute, value: minutes, to: self)!
}
func adding(seconds: Int) -> Date {
return Calendar.current.date(byAdding: .second, value: seconds, to: self)!
}
func format(style: DateFormatter.Style)->String{
let utcDateFormatter = DateFormatter()
utcDateFormatter.dateStyle = style
utcDateFormatter.timeStyle = style
return utcDateFormatter.string(from: self)
}
}