获取java.time.chrono.HijrahDate实例的月份名称 [英] Get Month Name of java.time.chrono.HijrahDate instance

查看:207
本文介绍了获取java.time.chrono.HijrahDate实例的月份名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HijrahDate hd=HijrahChronology.INSTANCE.date(LocalDate.of(2014,11, 25));

如果我们有 HijrahDate 实例,它是期望在 UmalquraCalendar API 中有一个显示月份名称的方法:

If we have HijrahDate Instance , it is expected to have a method in UmalquraCalendar API that shows the name of month :

我检查此实例的属性使用 groovy API

i inspect properties of this instance using groovy API :

['era':AH, 
'class':class java.time.chrono.HijrahDate, 
'prolepticMonth':17233,
 'eraValue':1,
 'dayOfWeek':2,
 'leapYear':false, 
'chronology':Hijrah-umalqura, 
'dayOfYear':32] 

但是我们没有找到必须是以下列表项之一的月份名称:

However we don't find the month name which must be one of the following list items :



  1. Muḥarram(محرم意思是禁止),因为在这个月里战斗是
    禁止(haram)。 Muharram包括
    Ashura日。

  2. Ṣafar(صفر意为无效),据说是因为
    异教阿拉伯房屋在一年中的这个时候是空的占用者
    聚集食物。

  3. Rabī'I(Rabī'al-Awwal,ربيعالأول)意为
    第一春。

  1. Muḥarram (محرم meaning "forbidden"), so called because battle was forbidden (haram) during this month. Muharram includes the Day of Ashura.
  2. Ṣafar (صفر meaning "void"), supposedly named thus because pagan Arab houses were empty this time of year while their occupants gathered food.
  3. Rabīʿ I (Rabīʿ al-Awwal, ربيع الأوّل) meaning "the first spring".

Rabī'II(Rabī'ath-Thānīربيعالثاني或Rabī'al-Ākhir
ربيعالآخ

Rabīʿ II (Rabīʿ ath-Thānī ربيع الثاني or Rabīʿ al-Ākhir ربيع الآخ

.....................
............等等 SEE

..................... ............ so on SEE

因此,由于没有属性保存月份的名称,因此有一个方法可以检索此信息吗?

Thus , since there is no attribute save month's name , it is expwcted to have a method retrieve this info ?

推荐答案

日期不包含有关月份或日期名称的信息。为此,您需要格式化程序:

The date does not contain information about the names of the months or days. To get that you need a formatter:

System.out.println(DateTimeFormatter.ofPattern("MMMM").format(hd));

打印 Safar

这篇关于获取java.time.chrono.HijrahDate实例的月份名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆