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<'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<'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_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_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<'py>(
py: Python<'py>,
timestamp: f64,
tzinfo: Option<&Bound<'py, PyTzInfo>>,
) -> PyResult<Bound<'py, PyDateTime>>
pub fn from_timestamp<'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 PyTypeCheck for PyDateTime
Available on Py_LIMITED_API
only.
impl PyTypeCheck for PyDateTime
Available on
Py_LIMITED_API
only.impl DerefToPyAny for PyDateTime
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