[erlang-questions] Date Conversion

Thomas Allen thomas@REDACTED
Wed Nov 14 16:26:43 CET 2012

On Wed, Nov 14, 2012 at 11:26:05AM +0200, Lucky Khoza wrote:
> Hi Erlang Developers,
> How do i convert date string: "2012/02/15" to 2012/2/15, just to get rid of
> trailing Zero.

The obligatory regular expression-based solution. Some might find this simple
look-behind assertion more direct than splitting and converting the components.

1> binary:list_to_bin(re:replace("2012/02/15", "(?<=/)0", "", [global])).


More information about the erlang-questions mailing list