Skip to content

Instantly share code, notes, and snippets.

@AdamSanderz
Forked from anvarazizov/printTime.swift
Created January 30, 2019 20:07
Show Gist options
  • Save AdamSanderz/70c36503a951fa7f0b4ac2bbb46285c3 to your computer and use it in GitHub Desktop.
Save AdamSanderz/70c36503a951fa7f0b4ac2bbb46285c3 to your computer and use it in GitHub Desktop.
print time in swift with milliseconds
func printDate(string: String) {
let date = Date()
let formatter = DateFormatter()
formatter.dateFormat = "HH:mm:ss.SSSS"
print(string + formatter.string(from: date))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment