Second (ParsiDateTime) - jalalvandi/ParsiDate GitHub Wiki

Method second (on ParsiDateTime)

Returns the second component of the time part of this ParsiDateTime.

Description

This method provides simple, read-only access to the second-of-the-minute value stored within the ParsiDateTime instance.

The value returned will be an integer between 0 and 59 (inclusive).

Assumption: This method assumes the ParsiDateTime instance holds a valid second number (0-59), as usually ensured by safe constructors.

Returns

  • An integer (u8 or similar type) representing the second of the minute (0-59).

Examples (Rust)

use parsidate::ParsiDateTime; // Assuming use of a hypothetical ParsiDateTime struct

// Example 1: Getting the second '45'
let dt = ParsiDateTime::new(1403, 5, 2, 15, 30, 45).unwrap();
assert_eq!(dt.second(), 45);

// Example 2: Getting the second '0' when time is exactly on the minute
let dt_on_the_minute = ParsiDateTime::new(1403, 5, 2, 15, 31, 0).unwrap();
assert_eq!(dt_on_the_minute.second(), 0);

// Example 3: Getting second '59'
// let dt_end_of_minute = ParsiDateTime::new(1403, 5, 2, 15, 31, 59).unwrap();
// assert_eq!(dt_end_of_minute.second(), 59);