[erlang-questions] Working with dates.
Michael McDaniel
erlangx@REDACTED
Mon Jul 16 03:40:45 CEST 2007
On Sun, Jul 15, 2007 at 06:39:18PM -0500, Julio César Carrascal Urquijo (MCTS) wrote:
> Hi,
>
> Two quick questions on functionality that I couldn't find on the documentation:
>
> 1) Are there functions in OTP to convert unix timestamp <--> the tuple
> format used in Erlang?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(del@REDACTED)174> Seconds = os:cmd("../c/time").
"1184549721"
(del@REDACTED)175> {Days, Time} = calendar:seconds_to_daystime( list_to_integer(Seconds) ).
{13710,{1,35,21}}
(del@REDACTED)176> Date = calendar:gregorian_days_to_date( Days ).
{37,7,15}
(del@REDACTED)177> calendar:datetime_to_gregorian_seconds( {Date, Time} ).
1184549721
(del@REDACTED)178>
~Michael
> 2) Are there functions for adding dates in this format?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
could add seconds and convert...
~Michael
>
> Thanks
>
> --
> Julio César Carrascal Urquijo
> Microsoft Certified Technology Specialist
> http://jcesar.3stecnoinformatica.com/
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
> !DSPAM:52,469ab05a73322052549877!
>
>
--
Michael McDaniel
Portland, Oregon, USA
http://autosys.us
+1 503 283 5284
More information about the erlang-questions
mailing list