[erlang-questions] add a time interval to a timestamp

Harsh J <>
Tue Mar 15 12:22:13 CET 2011


Hello,

How about handling this with seconds since year 0?
calendary:datetime_to_gregorian_seconds to get seconds, adding up this
integer in seconds as you need and converting back to datetime with
calendary:gregorian_seconds_to_datetime.

On Tue, Mar 15, 2011 at 4:24 PM, Loris Fichera <> wrote:
> Hello everybody,
>
> Say I want to write a function that takes as input a timestamp (in the
> form {{y,m,d}, {h,m,s}} ) and returns another timestamp, obtained by
> adding a certain amount of {hours, minutes, seconds} to the input.

-- 
Harsh J
http://harshj.com


More information about the erlang-questions mailing list