How to convert string representation of Date and Time to integer in Erlang and vice versa?

Lennart Öhman lennart.ohman@REDACTED
Sat Mar 8 17:22:01 CET 2003


There is a library in stdlib (calendar) which deals with the
more complicated issues related to date and time, like adding
a certain number of days to a date and finding out what correct
date the result will be etc etc.

Date and time are usually represented as a tuples of three
integers. And if date and time are given together, offen as a
tuple containing two tuples, e.g {{2002,3,19},{23,50,59}}.

Converting the basic data types integers and strings (list of
ascii values) is done with the BIFs integer_to_list/1 and
list_to_integer/1. See documentation on kernal application ->
erlang module for details.

With this it should be pretty simple to write the functionality
you are looking for.

/Lennart


Victoria Kulikou wrote:
> Is there a library in Erlang that provides conversion of Date and Time 
> from string to integer and from integer to string?
> 
>  
> 
> Sincerely,
> 
> Victoria.
> 


-------------------------------------------------------------
Lennart Ohman                   phone   : +46-8-587 623 27
Sjoland & Thyselius Telecom AB  cellular: +46-70-552 6735
Sehlstedtsgatan 6               fax     : +46-8-667 8230
SE-115 28 STOCKHOLM, SWEDEN     email   : lennart.ohman@REDACTED




More information about the erlang-questions mailing list