# Dateオブジェクト. 要素. 1. Year

# Excel

=YEAR(A1)

# JavaScript

d.getFullYear()  // 2017
d.getYear()      //  117

# PHP

$d->format('Y')

# Python

d.year      # 2017

# Ruby

d.year  # 2017

# Swift

c.component(.year, from: d) // 2017
let c:Calendar = Calendar(identifier: .gregorian)
let d:Date = c.date(from: DateComponents(year: 2017, month: 1, day: 23))!
c.component(.year, from: d) // 2017

[ 📩 ご意見 ]