Added TimeFormat() function to format the time according to the passed string of tokens.
//+------------------------------------------------------------------+//| Get the formatted time according to the passed string of tokens. |//| List of all available formats: |//| Format Output Description |//| ------ ---------------- ------------------------------------- |//| YY 18 Two-digit year |//| YYYY 2018 Four-digit year |//| M 1-12 The month, beginning at 1 |//| MM 01-12 The month, 2-digits |//| MMM Jan-Dec The abbreviated month name, 3-letters |//| MMMM January-December The full month name |//| D 1-31 The day of the month |//| DD 01-31 The day of the month, 2-digits |//| DDD Sun-Sat The short name of the day of the week |//| DDDD Sunday-Saturday The name of the day of the week |//| h 0-23 The hour |//| hh 00-23 The hour, 2-digits |//| H 1-12 The hour, 12-hour clock |//| HH 01-12 The hour, 12-hour clock, 2-digits |//| m 0-59 The minute |//| mm 00-59 The minute, 2-digits |//| s 0-59 The second |//| ss 00-59 The second, 2-digits |//| A AM PM |//| a am pm |//+------------------------------------------------------------------+//| Sample formats: |//| "YYYY.MM.DD hh:mm" // "2024.12.08 22:05" (default) |//| "DDD, YYYY.MM.DD hh:mm:ss" // "Sun, 2024.12.08 22:05:21" |//| "D MMMM YYYY, HH:mm a" // "8 December 2024, 10:05 pm" |//| "DD/MM/YYYY" // "08/12/2024" |//+------------------------------------------------------------------+string TimeFormat(constdatetime t, conststring format = "YYYY.MM.DD hh:mm");
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Watch out:
True. But I left it like that, because in this case it doesn't affect the result.
But here it does, so the array is of a different type.
Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
Особенности языка mql5, тонкости и приёмы работы
amrali, 2024.11.29 14:06
True. But I left it like that, because in this case it doesn't affect the result.
But here it does, so the array is of a different type.
Update 9 December 2024 - version 1.20
Added TimeFormat() function to format the time according to the passed string of tokens.
Update 10 December 2024 - version 1.30
Optimized TimeFormat(), StartOfYear() and EndOfYear() functions. Updated descriptions of some functions.
Update 15 December 2024 - version 1.35
Optimized the GetNthWeekdayInYearMonth() function.
Update 18 December 2024 - version 1.40
Added IsCurrentXXX(), IsToday(), IsTomorrow() and IsYesterday() functions.
Update 21 December 2024 - version 1.55
Simplified calculations in AddMonths(): replaced the complex logic of adjusting months and years with a simpler total months calculation.