DateValue
DateValue["elem"] gives the specified element of the current date and time. DateValue[date, elem] extracts the element from a specific date.
Examples
Get the current year:
DateValue["Year"]
(* 2025 *)Extract multiple elements:
DateValue[{"Month", "Day", "Year"}]
(* {1, 15, 2025} *)Get hour from a specific date:
DateValue[DateObject[{2024, 12, 25, 10, 30, 0}], "Hour"]
(* 10 *)Please visit the official Wolfram Language Reference for more details.