Added support for ISO 8601 date and time format.
This commit is contained in:
@@ -108,15 +108,11 @@ namespace Apostol {
|
|||||||
ch = StrDate.at(++pos);
|
ch = StrDate.at(++pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos == 10)
|
if (pos == 10 && Date.Length() == pos)
|
||||||
StrDate << " 00:00:00";
|
StrDate << " 00:00:00";
|
||||||
|
|
||||||
if (StrDate.Length() != 19 && StrDate.Length() != 23) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
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;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -130,8 +126,8 @@ namespace Apostol {
|
|||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
CDateTime StringToDate(const CString &Value, const CString &Format) {
|
CDateTime StringToDate(const CString &Value) {
|
||||||
return StrToDateTimeDef(Value.c_str(), 0, Format.c_str());
|
return StrToDateTimeDef(Value.c_str(), 0);
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Apostol {
|
|||||||
CString DoubleToBTC(const double &Value, const CString &Format = _T("%f BTC"));
|
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"));
|
CString DateToString(CDateTime Value, const CString &Format = _T("%Y-%m-%d %H:%M:%S"));
|
||||||
|
|
||||||
int VerifyDate(const CString &Date, CDateTime &Result);
|
int VerifyDate(const CString &Date, CDateTime &Result);
|
||||||
|
|||||||
Reference in New Issue
Block a user