次のコードでは、現在の日付を時間/分/秒単位の粒度を示す文字列として取得します。 2017年1月20日」。私はnone、.medium、.long、.fullのdateStyleで試しました。最も近い日まで細かくしか表示されません。どのように細かい粒度を得ることができますか?.longまたは.fullを使用した日付書式は時間/分/日/秒ではありません
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .full
let now = Date()
let dateString = dateFormatter.string(from: now)