Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
time_formatting_demo.mq5
Go to the documentation of this file.
1//+------------------------------------------------------------------+
2//| time_formatting_demo.mq5 |
3//| Time Shield - Formatting Examples |
4//| Copyright 2025, NewYaroslav |
5//| https://github.com/NewYaroslav/time-shield-cpp |
6//+------------------------------------------------------------------+
7#property script_show_inputs
8#property strict
9
10#include <TimeShield.mqh>
11
12void OnStart() {
13 time_shield::init();
14
15 datetime ts = (datetime)time_shield::to_ts(2024, time_shield::JUN, 21, 15, 30, 5);
16 long ts_ms = time_shield::to_ts_ms(2024, time_shield::JUN, 21, 15, 30, 5, 123);
17
18 Print("Custom: ", time_shield::to_string("%Y-%m-%d %H:%M:%S", ts));
19 Print("ISO8601: ", time_shield::to_iso8601(ts));
20 Print("ISO8601 UTC ms: ", time_shield::to_iso8601_utc_ms(ts_ms));
21 Print("ISO8601 +02: ", time_shield::to_iso8601(ts, 2*3600));
22 Print("MQL5: ", time_shield::to_mql5_date_time(ts));
23 Print("Windows filename: ", time_shield::to_windows_filename(ts));
24 Print("Human readable: ", time_shield::to_human_readable_ms(ts_ms));
25}