Quote:
Originally Posted by un_pogaz
small error in
Code:
# Convert the timestamp back into a datte
end_ts = format_date(start_ts, 'from_number');
Use end_ts instead of start_ts
|
Thanks for that.
There is an optimization available. 'from_number' also accepts the date format, so you can use:
Code:
# Convert the timestamp back into a datte
# Format the date as desired
format_date(end_ts, 'from_number:yyyy MM dd')
Here is the entire template with un_pogaz's correction and the optimization
Code:
program:
# Calculate number of seconds in a day
one_day = 60 * 60 * 24;
# Calculate total seconds for days of loan
loan_seconds = one_day * $#diasadevolver;
# Get the start date in ISO format
start_day = $$#fechaprestamo;
# Get the "timestamp" for the start date -- number of seconds since epoch
start_ts = format_date(start_day, 'to_number');
# Add the number of seconds for the days of loan
end_ts = start_ts + loan_seconds;
# Convert the timestamp back into a date
# Format the date as desired
format_date(end_ts, 'from_number:yyyy MM dd');