You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
801 B
25 lines
801 B
//
|
|
// DateFormatterExtension.swift
|
|
// GMERemittance
|
|
//
|
|
// Created by gme_2 on 03/10/2018.
|
|
// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension DateFormatter {
|
|
static func toDate(dateString: String, format: String = AppConstants.dateFormat) -> Date? {
|
|
let dateFormatter = DateFormatter()
|
|
dateFormatter.dateFormat = format
|
|
// dateFormatter.locale = Locale(identifier: "en_Us")
|
|
return dateFormatter.date(from: dateString)
|
|
}
|
|
|
|
static func toString(date: Date, format: String = AppConstants.humanReadableDateFormat) -> String {
|
|
let dateFormatter = DateFormatter()
|
|
dateFormatter.dateFormat = format
|
|
// dateFormatter.locale = Locale(identifier: "en_US")
|
|
return dateFormatter.string(from: date)
|
|
}
|
|
}
|