#[no_mangle]
pub unsafe extern "C" fn haystack_value_get_datetime_date(
    val: *const Value,
    utc: bool,
    result: *mut Value
) -> ResultType
Expand description

Get the date of a DateTime Value

Arguments

  • val A DateTime Value
  • utc True if need to return the utc variant, false returns the local variant
  • result The Value to be updated with the result DateTime.

Returns

  • 1 (True) if the operation was successful, -1 otherwise in which case the last_error_message can be called to get the error message.

Example

let date = haystack_value_make_date(2021, 8, 13);
let time = haystack_value_make_time(9, 45, 59);
let tz = std::ffi::CString::new("New_York").unwrap();
let val = haystack_value_make_tz_datetime(date, time, tz.as_ptr());
assert!(haystack_value_is_datetime(val));
assert_eq!(haystack_value_get_datetime_date(val, true, result), ResultType::TRUE);

Safety

Panics on invalid input data