diff --git a/drogon_ctl/templates/model_cc.csp b/drogon_ctl/templates/model_cc.csp index ebc8978b..588303d8 100644 --- a/drogon_ctl/templates/model_cc.csp +++ b/drogon_ctl/templates/model_cc.csp @@ -315,9 +315,9 @@ Json::Value {{className}}::toJson() const if(get<%c++$$<()) { <%c++if(col._colDatabaseType=="date"){%> - ret["<%c++$$<"]=get<%c++$$<()->toCustomedFormattedStringLocal("%Y-%m-%d", false); + ret["<%c++$$<"]=get<%c++$$<()->toDbStringLocal(); <%c++}else if(col._colDatabaseType.find("timestamp")!=std::string::npos||col._colDatabaseType.find("datetime")!=std::string::npos){%> - ret["<%c++$$<"]=get<%c++$$<()->toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S", true); + ret["<%c++$$<"]=get<%c++$$<()->toDbStringLocal(); <%c++}else if(col._colDatabaseType=="bytea"||col._colDatabaseType.find("blob")!=std::string::npos){%> ret["<%c++$$<"]=drogon::base64Encode((const unsigned char *)get<%c++$$<()->data(),get<%c++$$<()->size()); <%c++}else if(col._colType=="int64_t"){%> diff --git a/orm_lib/inc/drogon/orm/SqlBinder.h b/orm_lib/inc/drogon/orm/SqlBinder.h index a96bca85..f01bbdbe 100644 --- a/orm_lib/inc/drogon/orm/SqlBinder.h +++ b/orm_lib/inc/drogon/orm/SqlBinder.h @@ -350,11 +350,11 @@ class SqlBinder } self &operator<<(trantor::Date &&date) { - return operator<<(date.toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)); + return operator<<(date.toDbStringLocal()); } self &operator<<(const trantor::Date &date) { - return operator<<(date.toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)); + return operator<<(date.toDbStringLocal()); } self &operator<<(const std::vector &v) {