MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / setDate

Method setDate

src/openms/source/DATASTRUCTURES/DateTime.cpp:200–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198 }
199
200 void DateTime::setDate(const String& date)
201 {
202 QDate temp_date;
203
204 if (date.has('-'))
205 {
206 temp_date = QDate::fromString(date.c_str(), "yyyy-MM-dd");
207 }
208 else if (date.has('.'))
209 {
210 temp_date = QDate::fromString(date.c_str(), "dd-MM-yyyy");
211 }
212 else if (date.has('/'))
213 {
214 temp_date = QDate::fromString(date.c_str(), "MM/dd/yyyy");
215 }
216 else
217 {
218 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, date, "Could not set date");
219 }
220 if (!temp_date.isValid())
221 {
222 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, date, "Could not set date");
223 }
224
225 dt_->setDate(temp_date);
226 }
227
228 void DateTime::setTime(const String& time)
229 {

Callers 4

readOutHeaderMethod · 0.80
extractDateTime_Method · 0.80
setMethod · 0.80
DateTime_test.cppFile · 0.80

Calls 3

StringClass · 0.50
hasMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected