Days between dates: Difference between revisions

Content deleted Content added
→‎{{header|Erlang}}: added an alternative that is easier on the eyes.
→‎{{header|Erlang}}: Reversed the order of the alternate functions.
Line 17: Line 17:


% Return Year or Month or Date from datestring
% Return Year or Month or Date from datestring
dateToInts(String,POS) ->
dateToIntsToo(String, POS) ->
list_to_integer( lists:nth( POS, re:split(String ,"-", [{return,list},trim]) ) ).
list_to_integer( lists:nth( POS, string:tokens(String, "-") ) ).


% Alternative form of above
% Alternative form of above
% dateToIntsToo(String, POS) ->
% dateToInts(String,POS) ->
% list_to_integer( lists:nth( POS, string:tokens(String, "-") ) ).
% list_to_integer( lists:nth( POS, re:split(String ,"-", [{return,list},trim]) ) ).


% Return the number of days between dates formatted "2019-09-30"
% Return the number of days between dates formatted "2019-09-30"