From f6b93a3f5a29c5262fb812fb03676124b355f013 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 13 Feb 2009 02:04:09 -0400 Subject: [PATCH] Added a new valexpr function: format_date This can be used to format dates with a specific pattern, such as: format_date(entry.date, "%Y/%m/%d") This is used by the print command to ensure that Ledger is able to parse back what it prints. --- src/report.cc | 10 ++++++++++ src/report.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/report.cc b/src/report.cc index 1f8e4743..e1497dac 100644 --- a/src/report.cc +++ b/src/report.cc @@ -244,6 +244,11 @@ value_t report_t::fn_join(call_scope_t& args) return string_value(out.str()); } +value_t report_t::fn_format_date(call_scope_t& args) +{ + return string_value(format_date(args[0].to_date(), args[1].to_string())); +} + namespace { template (this));