@@ -21,11 +21,10 @@ from util cimport (is_datetime64_object, is_timedelta64_object,
2121 INT64_MAX)
2222
2323cimport ccalendar
24- from ccalendar import get_locale_names, MONTHS_FULL, DAYS_FULL
2524from conversion import tz_localize_to_utc, date_normalize
2625from conversion cimport (tz_convert_single, _TSObject,
2726 convert_to_tsobject, convert_datetime_to_tsobject)
28- from fields import get_date_field, get_start_end_field
27+ from fields import get_start_end_field, get_date_name_field
2928from nattype import NaT
3029from nattype cimport NPY_NAT
3130from np_datetime import OutOfBoundsDatetime
@@ -352,6 +351,16 @@ cdef class _Timestamp(datetime):
352351 field, freqstr, month_kw)
353352 return out[0 ]
354353
354+ cpdef _get_date_name_field(self , object field, object locale):
355+ cdef:
356+ int64_t val
357+ ndarray out
358+
359+ val = self ._maybe_convert_value_to_local()
360+ out = get_date_name_field(np.array([val], dtype = np.int64),
361+ field, locale = locale)
362+ return out[0 ]
363+
355364 @property
356365 def _repr_base (self ):
357366 return ' {date} {time}' .format(date = self ._date_repr,
@@ -702,45 +711,39 @@ class Timestamp(_Timestamp):
702711 def dayofweek (self ):
703712 return self .weekday()
704713
705- def day_name (self , time_locale = None ):
714+ def day_name (self , locale = None ):
706715 """
707716 Return the day name of the Timestamp with specified locale.
708717
709718 Parameters
710719 ----------
711- time_locale : string, default None (English locale)
720+ locale : string, default None (English locale)
712721 locale determining the language in which to return the day name
713722
714723 Returns
715724 -------
716725 day_name : string
726+
727+ .. versionadded:: 0.23.0
717728 """
718- if time_locale is None :
719- names = DAYS_FULL
720- else :
721- names = get_locale_names(' f_weekday' , time_locale)
722- days = dict (enumerate (names))
723- return days[self .weekday()].capitalize()
729+ return self ._get_date_name_field(' day_name' , locale)
724730
725- def month_name (self , time_locale = None ):
731+ def month_name (self , locale = None ):
726732 """
727733 Return the month name of the Timestamp with specified locale.
728734
729735 Parameters
730736 ----------
731- time_locale : string, default None (English locale)
737+ locale : string, default None (English locale)
732738 locale determining the language in which to return the month name
733739
734740 Returns
735741 -------
736742 month_name : string
743+
744+ .. versionadded:: 0.23.0
737745 """
738- if time_locale is None :
739- names = MONTHS_FULL
740- else :
741- names = get_locale_names(' f_month' , time_locale)
742- months = dict (enumerate (names))
743- return months[self .month].capitalize()
746+ return self ._get_date_name_field(' month_name' , locale)
744747
745748 @property
746749 def weekday_name (self ):
0 commit comments