Return to Snippet

Revision: 20819
at November 25, 2009 22:04 by wearetherock


Initial Code
-module(cal).
-export([main/0]).

main() ->
    StartSec = calendar:datetime_to_gregorian_seconds({{2009,1,1},{0,0,0}}),
    EndSec = calendar:datetime_to_gregorian_seconds({{2009,12,31},{0,0,0}}),
    run_calendar(false, StartSec, EndSec).

run_calendar(true, _StartSec, _EndSec) -> 
   init:stop() ;

run_calendar(false, CurSec, EndSec) -> 
    { {Year,Month,Day} ,_Time} = calendar:gregorian_seconds_to_datetime(CurSec),
    io:format("~p/~p/~p ~n", [Year,Month,Day]),
    NewSec = CurSec + 60*60*24,
    run_calendar(NewSec > EndSec, NewSec, EndSec).

Initial URL

                                

Initial Description

                                

Initial Title
All day in this year

Initial Tags

                                

Initial Language
Scala