Menu

DateTimeCalendarFieldNames

Stephen Colebourne

Calendar fields (such as day of week and hour of day) have names.

There are two basic naming strategies:

Option 1 - Consistent

The consistent option names fields using 'of' in the middle, like unitOfRange.

  • SecondOfMinute
  • MinuteOfHour
  • MinuteOfDay
  • HourOfDay
  • HourOfMeridiem
  • DayOfWeek
  • DayOfMonth
  • DayOfYear
  • MonthOfYear
  • Year - no 'Of' as year is unbound

Option 2 - Focussed

The focussed option names fields using just the unit for all the common cases, unless there is ambiguity as to the common case. All other fields are named as per option 1.

  • Second
  • Minute
  • MinuteOfDay
  • Hour
  • HourOfMeridiem
  • DayOfWeek
  • DayOfMonth
  • DayOfYear
  • Month
  • Year


Related

OldWiki: Historic_choices
OldWiki: ThreeTen

MongoDB Logo MongoDB