pub struct PyDateTime(/* private fields */);
Expand description
Bindings for datetime.datetime
.
Values of this type are accessed via PyO3’s smart pointers, e.g. as
Py<PyDateTime>
or Bound<'py, PyDateTime>
.
Implementations§
Source§impl PyDateTime
impl PyDateTime
Sourcepub fn new_bound<'py>(
py: Python<'py>,
year: i32,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8,
microsecond: u32,
tzinfo: Option<&Bound<'py, PyTzInfo>>,
) -> PyResult<Bound<'py, PyDateTime>>
pub fn new_bound<'py>( py: Python<'py>, year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, microsecond: u32, tzinfo: Option<&Bound<'py, PyTzInfo>>, ) -> PyResult<Bound<'py, PyDateTime>>
Creates a new datetime.datetime
object.
Sourcepub fn new_bound_with_fold<'py>(
py: Python<'py>,
year: i32,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8,
microsecond: u32,
tzinfo: Option<&Bound<'py, PyTzInfo>>,
fold: bool,
) -> PyResult<Bound<'py, PyDateTime>>
pub fn new_bound_with_fold<'py>( py: Python<'py>, year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, microsecond: u32, tzinfo: Option<&Bound<'py, PyTzInfo>>, fold: bool, ) -> PyResult<Bound<'py, PyDateTime>>
Alternate constructor that takes a fold
parameter. A true
value for this parameter
signifies this this datetime is the later of two moments with the same representation,
during a repeated interval.
This typically occurs at the end of daylight savings time. Only valid if the represented time is ambiguous. See PEP 495 for more detail.
Sourcepub fn from_timestamp_bound<'py>(
py: Python<'py>,
timestamp: f64,
tzinfo: Option<&Bound<'py, PyTzInfo>>,
) -> PyResult<Bound<'py, PyDateTime>>
pub fn from_timestamp_bound<'py>( py: Python<'py>, timestamp: f64, tzinfo: Option<&Bound<'py, PyTzInfo>>, ) -> PyResult<Bound<'py, PyDateTime>>
Construct a datetime
object from a POSIX timestamp
This is equivalent to datetime.datetime.fromtimestamp
Trait Implementations§
Source§impl AsPyPointer for PyDateTime
impl AsPyPointer for PyDateTime
Source§impl AsRef<PyAny> for PyDateTime
impl AsRef<PyAny> for PyDateTime
Source§impl Deref for PyDateTime
impl Deref for PyDateTime
Source§impl PyTypeInfo for PyDateTime
impl PyTypeInfo for PyDateTime
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
Source§fn is_type_of_bound(obj: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(obj: &Bound<'_, PyAny>) -> bool
Checks if
object
is an instance of this type or a subclass of this type.impl DerefToPyAny for PyDateTime
impl PyLayout<PyDateTime> for PyDateTime_DateTime
impl PySizedLayout<PyDateTime> for PyDateTime_DateTime
Auto Trait Implementations§
impl !Freeze for PyDateTime
impl !RefUnwindSafe for PyDateTime
impl !Send for PyDateTime
impl !Sync for PyDateTime
impl Unpin for PyDateTime
impl UnwindSafe for PyDateTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more