[erlang-questions] timestamp conversion

Steve Davis steven.charles.davis@REDACTED
Sat Apr 16 01:15:30 CEST 2011


I've not exhaustively tested this but a direct comparison of the list
(though I prefer binary text representations for a whole raft of
reasons)... should work for you.

e.g. given the string format (esp. length) is known to be exactly the
same:
L1 = "2011-04-15T23:00:48Z"
L2 = "2011-04-15T23:00:53Z"

4> L1 < L2.
true
5> L1 > L2.
false

etc.

On Apr 15, 5:13 pm, "Peter W. Morreale" <pmorre...@REDACTED> wrote:
> This may be embarrassingly simple, but I am struggling with it...
>
> I need compare string timestamps for dealing with expiration.   In some
> cases it may another string timestamp, in others it will be against the
> current time.
>
> The string timestamps will always have the format:
>
> Year-Month-DayTHour:Min:SecZ"
>
> I think I want to convert to integer seconds, however even then its not
> clear to me how to perform the comparison, although I think this is a
> case for using the "if" expression.  
>
> Please be gentle, I'm still new to Erlang.
>
> Thanks much
> -PWM
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list