From e4fc22df9561cb30c33939121cdac4b24c801471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=80=D0=B5=D0=BF=D0=BE=D0=B4=D0=BE=D0=B1=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BD?= Date: Wed, 3 Dec 2025 22:56:39 +0300 Subject: [PATCH] Added support for ISO 8601 date and time format. --- src/app/Deal.cpp | 12 ++++-------- src/app/Deal.hpp | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/app/Deal.cpp b/src/app/Deal.cpp index 1f49e8a..8c5c7c7 100644 --- a/src/app/Deal.cpp +++ b/src/app/Deal.cpp @@ -108,15 +108,11 @@ namespace Apostol { ch = StrDate.at(++pos); } - if (pos == 10) + if (pos == 10 && Date.Length() == pos) StrDate << " 00:00:00"; - if (StrDate.Length() != 19 && StrDate.Length() != 23) { - return 0; - } - try { - if ((Result = StrToDateTimeDef(StrDate.c_str(), 0, "%04d-%02d-%02d %02d:%02d:%02d")) == 0) + if ((Result = StrToDateTimeDef(StrDate.c_str(), 0)) == 0) return -1; return 1; @@ -130,8 +126,8 @@ namespace Apostol { } //-------------------------------------------------------------------------------------------------------------- - CDateTime StringToDate(const CString &Value, const CString &Format) { - return StrToDateTimeDef(Value.c_str(), 0, Format.c_str()); + CDateTime StringToDate(const CString &Value) { + return StrToDateTimeDef(Value.c_str(), 0); } //-------------------------------------------------------------------------------------------------------------- diff --git a/src/app/Deal.hpp b/src/app/Deal.hpp index 3f529e8..8e808f7 100644 --- a/src/app/Deal.hpp +++ b/src/app/Deal.hpp @@ -43,7 +43,7 @@ namespace Apostol { CString DoubleToBTC(const double &Value, const CString &Format = _T("%f BTC")); //-------------------------------------------------------------------------------------------------------------- - CDateTime StringToDate(const CString &Value, const CString &Format = _T("%04d-%02d-%02d %02d:%02d:%02d")); + CDateTime StringToDate(const CString &Value); CString DateToString(CDateTime Value, const CString &Format = _T("%Y-%m-%d %H:%M:%S")); int VerifyDate(const CString &Date, CDateTime &Result);