ICU4X
International Components for Unicode
Loading...
Searching...
No Matches
ICU4XDateTime Class Reference

#include <ICU4XDateTime.hpp>

Public Member Functions

ICU4XDate date () const
 
ICU4XTime time () const
 
ICU4XIsoDateTime to_iso () const
 
ICU4XDateTime to_calendar (const ICU4XCalendar &calendar) const
 
uint8_t hour () const
 
uint8_t minute () const
 
uint8_t second () const
 
uint32_t nanosecond () const
 
uint16_t day_of_year () const
 
uint32_t day_of_month () const
 
ICU4XIsoWeekday day_of_week () const
 
uint32_t week_of_month (ICU4XIsoWeekday first_weekday) const
 
diplomat::result< ICU4XWeekOf, ICU4XErrorweek_of_year (const ICU4XWeekCalculator &calculator) const
 
uint32_t ordinal_month () const
 
template<typename W>
diplomat::result< std::monostate, ICU4XErrormonth_code_to_writeable (W &write) const
 
diplomat::result< std::string, ICU4XErrormonth_code () const
 
int32_t year_in_era () const
 
template<typename W>
diplomat::result< std::monostate, ICU4XErrorera_to_writeable (W &write) const
 
diplomat::result< std::string, ICU4XErrorera () const
 
uint8_t months_in_year () const
 
uint8_t days_in_month () const
 
uint16_t days_in_year () const
 
ICU4XCalendar calendar () const
 
 ICU4XDateTime (capi::ICU4XDateTime *i)
 
 ICU4XDateTime ()=default
 
 ICU4XDateTime (ICU4XDateTime &&) noexcept=default
 
ICU4XDateTimeoperator= (ICU4XDateTime &&other) noexcept=default
 

Static Public Member Functions

static diplomat::result< ICU4XDateTime, ICU4XErrorcreate_from_iso_in_calendar (int32_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t nanosecond, const ICU4XCalendar &calendar)
 
static diplomat::result< ICU4XDateTime, ICU4XErrorcreate_from_codes_in_calendar (const std::string_view era_code, int32_t year, const std::string_view month_code, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t nanosecond, const ICU4XCalendar &calendar)
 
static ICU4XDateTime create_from_date_and_time (const ICU4XDate &date, const ICU4XTime &time)
 

Detailed Description

An ICU4X DateTime object capable of containing a date and time for any calendar.

See the Rust documentation for DateTime for more information.

Constructor & Destructor Documentation

◆ ICU4XDateTime() [1/3]

ICU4XDateTime::ICU4XDateTime ( capi::ICU4XDateTime * i)
inlineexplicit

◆ ICU4XDateTime() [2/3]

ICU4XDateTime::ICU4XDateTime ( )
default

◆ ICU4XDateTime() [3/3]

ICU4XDateTime::ICU4XDateTime ( ICU4XDateTime && )
defaultnoexcept

Member Function Documentation

◆ calendar()

ICU4XCalendar ICU4XDateTime::calendar ( ) const
inline

Returns the [ICU4XCalendar] object backing this date

See the Rust documentation for calendar for more information.

◆ create_from_codes_in_calendar()

diplomat::result< ICU4XDateTime, ICU4XError > ICU4XDateTime::create_from_codes_in_calendar ( const std::string_view era_code,
int32_t year,
const std::string_view month_code,
uint8_t day,
uint8_t hour,
uint8_t minute,
uint8_t second,
uint32_t nanosecond,
const ICU4XCalendar & calendar )
inlinestatic

Creates a new [ICU4XDateTime] from the given codes, which are interpreted in the given calendar system

See the Rust documentation for try_new_from_codes for more information.

◆ create_from_date_and_time()

ICU4XDateTime ICU4XDateTime::create_from_date_and_time ( const ICU4XDate & date,
const ICU4XTime & time )
inlinestatic

Creates a new [ICU4XDateTime] from an [ICU4XDate] and [ICU4XTime] object

See the Rust documentation for new for more information.

◆ create_from_iso_in_calendar()

diplomat::result< ICU4XDateTime, ICU4XError > ICU4XDateTime::create_from_iso_in_calendar ( int32_t year,
uint8_t month,
uint8_t day,
uint8_t hour,
uint8_t minute,
uint8_t second,
uint32_t nanosecond,
const ICU4XCalendar & calendar )
inlinestatic

Creates a new [ICU4XDateTime] representing the ISO date and time given but in a given calendar

See the Rust documentation for new_from_iso for more information.

◆ date()

ICU4XDate ICU4XDateTime::date ( ) const
inline

Gets a copy of the date contained in this object

See the Rust documentation for date for more information.

◆ day_of_month()

uint32_t ICU4XDateTime::day_of_month ( ) const
inline

Returns the 1-indexed day in the month for this date

See the Rust documentation for day_of_month for more information.

◆ day_of_week()

ICU4XIsoWeekday ICU4XDateTime::day_of_week ( ) const
inline

Returns the day in the week for this day

See the Rust documentation for day_of_week for more information.

◆ day_of_year()

uint16_t ICU4XDateTime::day_of_year ( ) const
inline

Returns the 1-indexed day in the year for this date

See the Rust documentation for day_of_year_info for more information.

◆ days_in_month()

uint8_t ICU4XDateTime::days_in_month ( ) const
inline

Returns the number of days in the month represented by this date

See the Rust documentation for days_in_month for more information.

◆ days_in_year()

uint16_t ICU4XDateTime::days_in_year ( ) const
inline

Returns the number of days in the year represented by this date

See the Rust documentation for days_in_year for more information.

◆ era()

diplomat::result< std::string, ICU4XError > ICU4XDateTime::era ( ) const
inline

Returns the era for this date,

See the Rust documentation for year for more information.

◆ era_to_writeable()

template<typename W>
diplomat::result< std::monostate, ICU4XError > ICU4XDateTime::era_to_writeable ( W & write) const
inline

Returns the era for this date,

See the Rust documentation for year for more information.

◆ hour()

uint8_t ICU4XDateTime::hour ( ) const
inline

Returns the hour in this time

See the Rust documentation for hour for more information.

◆ minute()

uint8_t ICU4XDateTime::minute ( ) const
inline

Returns the minute in this time

See the Rust documentation for minute for more information.

◆ month_code()

diplomat::result< std::string, ICU4XError > ICU4XDateTime::month_code ( ) const
inline

Returns the month code for this date. Typically something like "M01", "M02", but can be more complicated for lunar calendars.

See the Rust documentation for month for more information.

◆ month_code_to_writeable()

template<typename W>
diplomat::result< std::monostate, ICU4XError > ICU4XDateTime::month_code_to_writeable ( W & write) const
inline

Returns the month code for this date. Typically something like "M01", "M02", but can be more complicated for lunar calendars.

See the Rust documentation for month for more information.

◆ months_in_year()

uint8_t ICU4XDateTime::months_in_year ( ) const
inline

Returns the number of months in the year represented by this date

See the Rust documentation for months_in_year for more information.

◆ nanosecond()

uint32_t ICU4XDateTime::nanosecond ( ) const
inline

Returns the nanosecond in this time

See the Rust documentation for nanosecond for more information.

◆ operator=()

ICU4XDateTime & ICU4XDateTime::operator= ( ICU4XDateTime && other)
defaultnoexcept

◆ ordinal_month()

uint32_t ICU4XDateTime::ordinal_month ( ) const
inline

Returns 1-indexed number of the month of this date in its year

Note that for lunar calendars this may not lead to the same month having the same ordinal month across years; use month_code if you care about month identity.

See the Rust documentation for month for more information.

◆ second()

uint8_t ICU4XDateTime::second ( ) const
inline

Returns the second in this time

See the Rust documentation for second for more information.

◆ time()

ICU4XTime ICU4XDateTime::time ( ) const
inline

Gets the time contained in this object

See the Rust documentation for time for more information.

◆ to_calendar()

ICU4XDateTime ICU4XDateTime::to_calendar ( const ICU4XCalendar & calendar) const
inline

Convert this datetime to one in a different calendar

See the Rust documentation for to_calendar for more information.

◆ to_iso()

ICU4XIsoDateTime ICU4XDateTime::to_iso ( ) const
inline

Converts this date to ISO

See the Rust documentation for to_iso for more information.

◆ week_of_month()

uint32_t ICU4XDateTime::week_of_month ( ICU4XIsoWeekday first_weekday) const
inline

Returns the week number in this month, 1-indexed, based on what is considered the first day of the week (often a locale preference).

first_weekday can be obtained via first_weekday() on [ICU4XWeekCalculator]

See the Rust documentation for week_of_month for more information.

◆ week_of_year()

diplomat::result< ICU4XWeekOf, ICU4XError > ICU4XDateTime::week_of_year ( const ICU4XWeekCalculator & calculator) const
inline

Returns the week number in this year, using week data

See the Rust documentation for week_of_year for more information.

◆ year_in_era()

int32_t ICU4XDateTime::year_in_era ( ) const
inline

Returns the year number in the current era for this date

See the Rust documentation for year for more information.


The documentation for this class was generated from the following file: