Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Peng aoenth

  • Toronto, Canada
View GitHub Profile
View CZ006.swift
let dict = [
"zi": "rat",
"chou": "ox",
"yin": "tiger",
"mao": "rabbit",
"chen": "dragon",
"si": "snake",
"wu": "horse",
"wei": "goat",
"shen": "monkey",
View CZ004.swift
let formatter = DateFormatter()
formatter.dateFormat = "MMM d, yyyy"
formatter.calendar = .init(identifier: .chinese)
formatter.dateStyle = .full
print(formatter.string(from: normalDate))
View CZ003.swift
let formatter = DateFormatter()
formatter.dateFormat = "MMM d, yyyy"
print(formatter.string(from: normalDate))
View CZ002.swift
let calendar = Calendar(identifier: .gregorian)
let normalDate = calendar.date(from: normalCalendarDateComponents)!
View CZ005.csv
What Swift gives us What it says in Chinese Associated Zodiac
zi rat
chou ox
yin tiger
mao rabbit
chen dragon
si snake
wu horse
wei goat
shen monkey
View CZ001.swift
var normalCalendarDateComponents = DateComponents()
normalCalendarDateComponents.year = 2020
normalCalendarDateComponents.month = 5
normalCalendarDateComponents.day = 1