Mercurial > public > lazybear
comparison LazyBear/Global functions/ConvertStringToDate.swift @ 417:5f21f7c23c5e
Add comments and clean code
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Fri, 11 Jun 2021 11:37:42 +0200 |
parents | 681fb377235e |
children |
comparison
equal
deleted
inserted
replaced
416:1662a41e2c1a | 417:5f21f7c23c5e |
---|---|
5 // Created by Dennis Concepción Martín on 7/6/21. | 5 // Created by Dennis Concepción Martín on 7/6/21. |
6 // | 6 // |
7 | 7 |
8 import SwiftUI | 8 import SwiftUI |
9 | 9 |
10 /* | |
11 Convert String to date with the format specified | |
12 */ | |
10 func convertStringToDate(_ stringDate: String) -> Date { | 13 func convertStringToDate(_ stringDate: String) -> Date { |
11 // Convert string to date | |
12 let dateFormatter = DateFormatter() | 14 let dateFormatter = DateFormatter() |
13 dateFormatter.dateFormat = "yyyy-MM-dd" | 15 dateFormatter.dateFormat = "yyyy-MM-dd" |
14 | 16 |
15 let date = dateFormatter.date(from: stringDate)! | 17 let date = dateFormatter.date(from: stringDate)! |
16 | 18 |