Struct pyo3::types::datetime::PyDateTime
source · #[repr(transparent)]pub struct PyDateTime(PyAny);
Available on non-
Py_LIMITED_API
only.Expand description
Bindings for datetime.datetime
Tuple Fields§
§0: PyAny
Implementations§
source§impl PyDateTime
impl PyDateTime
#[doc(hidden)] pub const _PYO3_DEF: AddTypeToModule<Self> = _
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
Methods from Deref<Target = PyAny>§
#[doc(hidden)] pub const _PYO3_DEF: AddTypeToModule<Self> = _
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 PyClassBaseType for PyDateTime
impl PyClassBaseType for PyDateTime
source§impl PyTypeInfo for PyDateTime
impl PyTypeInfo for PyDateTime
source§const NAME: &'static str = "PyDateTime"
const NAME: &'static str = "PyDateTime"
Available on non-crate feature
gil-refs
only.Class name.
source§const MODULE: Option<&'static str> = _
const MODULE: Option<&'static str> = _
Available on non-crate feature
gil-refs
only.Module name, if any.
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Available on non-crate feature
gil-refs
only.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
Available on non-crate feature
gil-refs
only.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> AssertNotZeroSized for T
impl<T> AssertNotZeroSized for T
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more