lnd-demo-app/wallet/Utils/Extensions/Date.swift
2023-06-08 09:36:06 +03:00

25 lines
676 B
Swift

//
// 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)
}
}