Allow date and datetime values to be formatted into strings
This commit is contained in:
parent
b94512e4cc
commit
c87882076b
1 changed files with 19 additions and 0 deletions
19
src/value.cc
19
src/value.cc
|
|
@ -863,6 +863,25 @@ void value_t::in_place_cast(type_t cast_type)
|
|||
}
|
||||
break;
|
||||
|
||||
case DATE:
|
||||
switch (cast_type) {
|
||||
case STRING:
|
||||
set_string(format_date(as_date(), string("%Y-%m-%d")));
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DATETIME:
|
||||
switch (cast_type) {
|
||||
case STRING:
|
||||
set_string(format_datetime(as_datetime(), string("%Y-%m-%d %H:%M:%S")));
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case INTEGER:
|
||||
switch (cast_type) {
|
||||
case AMOUNT:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue