Skip to content

Instantly share code, notes, and snippets.

@paulofaria
Created June 21, 2016 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paulofaria/4e57dfa60eae088df2c9a3a3bee7630b to your computer and use it in GitHub Desktop.
Save paulofaria/4e57dfa60eae088df2c9a3a3bee7630b to your computer and use it in GitHub Desktop.
func getDateTime() -> (String, String) {
let now = NSDate()
let dayTimePeriodFormatter = NSDateFormatter()
dayTimePeriodFormatter.dateFormat = "E, d MMM yyyy"
let date = dayTimePeriodFormatter.string(from: now)
dayTimePeriodFormatter.dateFormat = "HH:mm:ss Z"
let time = dayTimePeriodFormatter.string(from: now)
return (date, time)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment