Blender V5.3
BLT_date_string.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
13
14#include <ctime>
15#include <string>
16
17#include "BLI_string_ref.hh"
18
20
21enum class DateFormat : uint8_t {
27 LE_Dot = 2,
35 BE_Dot = 6,
38};
39
40enum class TimeFormat : uint8_t {
42 H24 = 0,
44 H12 = 1,
45};
46
47std::tm localtime_safe(time_t time);
48
49std::string date(const std::tm &date_time,
50 StringRef locale_iso = {},
52
53std::string time(const std::tm &date_time, TimeFormat format = TimeFormat::H24);
54
55std::string datetime(const std::tm &date_time,
56 StringRef locale_iso = {},
57 DateFormat date_format = DateFormat::Default,
58 TimeFormat time_format = TimeFormat::H24,
59 const std::tm *now = nullptr,
60 StringRef today = {},
61 StringRef yesterday = {});
62
63} // namespace blender::date_string
std::string time(const std::tm &date_time, TimeFormat format=TimeFormat::H24)
std::string datetime(const std::tm &date_time, StringRef locale_iso={}, DateFormat date_format=DateFormat::Default, TimeFormat time_format=TimeFormat::H24, const std::tm *now=nullptr, StringRef today={}, StringRef yesterday={})
std::tm localtime_safe(time_t time)
std::string date(const std::tm &date_time, StringRef locale_iso={}, DateFormat format=DateFormat::Default)
unsigned char uint8_t
Definition BKE_text.h:79
@ Default
Definition types.hh:129