| 113 | } |
| 114 | |
| 115 | bool DateParser::ParseIsoSqlFormat(const char* str, int len, |
| 116 | const DateTimeFormatContext& dt_ctx, DateValue* date) { |
| 117 | DCHECK(dt_ctx.toks.size() > 0); |
| 118 | DCHECK(date != nullptr); |
| 119 | DCHECK(dt_ctx.has_date_toks); |
| 120 | |
| 121 | if (UNLIKELY(str == nullptr || len <= 0)) return IndicateDateParseFailure(date); |
| 122 | |
| 123 | DateTimeParseResult dt_result; |
| 124 | bool result = IsoSqlFormatParser::ParseDateTime(str, len, dt_ctx, &dt_result); |
| 125 | if (!result) return IndicateDateParseFailure(date); |
| 126 | |
| 127 | *date = DateValue(dt_result.year, dt_result.month, dt_result.day); |
| 128 | return date->IsValid(); |
| 129 | } |
| 130 | |
| 131 | // Formats date into dst using the default format |
| 132 | // Format: yyyy-MM-dd |