MCPcopy Create free account
hub / github.com/apache/arrow-rs / timestamp_ms_to_datetime

Function timestamp_ms_to_datetime

arrow-array/src/temporal_conversions.rs:174–184  ·  view source on GitHub ↗
(v: i64)

Source from the content-addressed store, hash-verified

172/// converts a `i64` representing a `timestamp(ms)` to [`NaiveDateTime`]
173#[inline]
174pub fn timestamp_ms_to_datetime(v: i64) -> Option<NaiveDateTime> {
175 let (sec, milli_sec) = split_second(v, MILLISECONDS);
176
177 let datetime = DateTime::from_timestamp(
178 // extract seconds from milliseconds
179 sec,
180 // discard extracted seconds and convert milliseconds to nanoseconds
181 milli_sec * MICROSECONDS as u32,
182 )?;
183 Some(datetime.naive_utc())
184}
185
186/// converts a `i64` representing a `timestamp(us)` to [`NaiveDateTime`]
187#[inline]

Callers 2

date_partMethod · 0.85
as_datetimeFunction · 0.85

Calls 1

split_secondFunction · 0.85

Tested by

no test coverage detected