17#if defined(__xtd__cpp_lib_format)
215 template<
class clock_t,
class duration_t = clock_t::duration>
216 date_time(
const std::chrono::time_point<clock_t, duration_t>& time_point) {
217 using namespace std::chrono;
218 *
this = from_time_t(system_clock::to_time_t(system_clock::now() + duration_cast<system_clock::duration>(time_point - clock_t::now())), date_time_kind::local);
225 template<
class clock_t,
class duration_t = clock_t::duration>
227 using namespace std::chrono;
228 *
this = from_time_t(system_clock::to_time_t(system_clock::now() + duration_cast<system_clock::duration>(time_point - clock_t::now())), kind);
643 bool equals(const
object& obj) const noexcept override;
647 bool equals(const
date_time& other) const noexcept override;
651 xtd::
size get_hash_code() const noexcept override;
655 std::vector<
string> get_date_time_formats() const noexcept;
661 bool is_daylight_saving_time() const noexcept;
734 const
xtd::
string to_long_date_string() const;
739 const
xtd::
string to_long_time_string() const;
744 const
xtd::
string to_short_date_string() const;
749 const
xtd::
string to_short_time_string() const;
754 xtd::
string to_string() const noexcept override;
811 xtd::
string to_string(const
string& format) const;
869 xtd::
string to_string(const
string& format, const std::locale& loc) const override;
875 std::time_t to_time_t() const;
881 std::tm to_tm() const;
1141 static
bool try_parse(const
string& s,
date_time& result) noexcept;
Contains std::chrono::days, std::chrono::weeks, std::chrono::months and std::chrono::years duration t...
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.hpp:85
date_time(uint32 year, uint32 month, uint32 day, uint32 hour, uint32 minute, uint32 second, uint32 millisecond, date_time_kind kind)
Initializes a new instance of the xtd::date_time structure to the specified year, month,...
static const date_time min_value
Represents the smallest possible value of xtd::date_time. This field is read-only.
Definition date_time.hpp:107
date_time(int64 ticks)
Initializes a new instance of the xtd::date_time structure to a specified number of ticks.
date_time date() const noexcept
Gets the date component of this instance.
date_time(xtd::ticks ticks, xtd::date_time_kind kind)
Initializes a new instance of the xtd::date_time structure to a specified number of ticks and to Coor...
date_time(uint32 year, uint32 month, uint32 day)
Initializes a new instance of the xtd::date_time structure to the specified year, month,...
date_time(const std::chrono::time_point< clock_t, duration_t > &time_point, date_time_kind kind)
Initializes a new instance of the xtd::date_time structure to a specified time point,...
Definition date_time.hpp:226
date_time(int64 ticks, xtd::date_time_kind kind)
Initializes a new instance of the xtd::date_time structure to a specified number of ticks and to Coor...
date_time(uint32 year, uint32 month, uint32 day, uint32 hour, uint32 minute, uint32 second, date_time_kind kind)
Initializes a new instance of the xtd::date_time structure to the specified year, month,...
date_time(xtd::ticks ticks)
Initializes a new instance of the xtd::date_time structure to a specified number of ticks.
date_time()=default
Initializes a new instance of the xtd::date_time structure.
date_time(uint32 year, uint32 month, uint32 day, uint32 hour, uint32 minute, uint32 second, uint32 millisecond)
Initializes a new instance of the xtd::date_time structure to the specified year, month,...
date_time(const std::chrono::time_point< clock_t, duration_t > &time_point)
Initializes a new instance of the xtd::date_time structure to a specified time point.
Definition date_time.hpp:216
date_time(uint32 year, uint32 month, uint32 day, uint32 hour, uint32 minute, uint32 second)
Initializes a new instance of the xttd::date_time structure to the specified year,...
static const date_time max_value
Represents the largest possible value of xtd::date_time. This field is read-only.
Definition date_time.hpp:97
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Represents a time interval.
Definition time_span.hpp:29
Represents any time zone in the world.
Definition time_zone_info.hpp:38
Contains xtd::date_time_kind enum class.
Contains xtd::day_of_week enum class.
#define core_export_
Define shared library export.
Definition core_export.hpp:13
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
std::chrono::duration< int64, tick > ticks
Represents a tick duration.
Definition ticks.hpp:21
date_time_kind
Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC),...
Definition date_time_kind.hpp:21
month_of_year
Specifies the month of the year.
Definition month_of_year.hpp:21
day_of_week
Specifies the day of the week.
Definition day_of_week.hpp:25
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
Contains xtd::month_of_year enum class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::object class.
Contains xtd::string alias.
Contains xtd::ticks typedef.
Contains xtd::time_span class.