summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-22 22:13:22 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-22 22:22:54 -0400
commitea418c7fbcd54d7222583914477d087fe7d6c5e8 (patch)
tree51573ca732d6de04deaf7ec2cc1a1e682a2b7599
parentf6b14cc34aaf3545c9709bb72eb1db643488c616 (diff)
downloadfork-ledger-ea418c7fbcd54d7222583914477d087fe7d6c5e8.tar.gz
fork-ledger-ea418c7fbcd54d7222583914477d087fe7d6c5e8.tar.bz2
fork-ledger-ea418c7fbcd54d7222583914477d087fe7d6c5e8.zip
Allow date and datetime values to inter-convert
-rw-r--r--src/value.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/value.cc b/src/value.cc
index d39597bd..54a6038f 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -907,6 +907,9 @@ void value_t::in_place_cast(type_t cast_type)
case DATE:
switch (cast_type) {
+ case DATETIME:
+ set_datetime(datetime_t(as_date(), time_duration(0, 0, 0, 0)));
+ return;
case STRING:
set_string(format_date(as_date(), string("%Y-%m-%d")));
return;
@@ -916,6 +919,9 @@ void value_t::in_place_cast(type_t cast_type)
break;
case DATETIME:
switch (cast_type) {
+ case DATE:
+ set_date(as_datetime().date());
+ return;
case STRING:
set_string(format_datetime(as_datetime(), string("%Y-%m-%d %H:%M:%S")));
return;