From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p19HkulP004141 for ; Wed, 9 Feb 2011 18:46:56 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmUAAPFhUk2AAtnEkWdsb2JhbACXLI4cFQEBAQEJCwoHEQUfszaIaYVcBIR/ X-IronPort-AV: E=Sophos;i="4.60,446,1291590000"; d="scan'208";a="99585904" Received: from smtp01.srv.cs.cmu.edu ([128.2.217.196]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 09 Feb 2011 18:46:51 +0100 Received: from jaguar.home (pool-173-75-141-44.pitbpa.fios.verizon.net [173.75.141.44]) (authenticated bits=0) by smtp01.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id p19Hkmoj011976 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 9 Feb 2011 12:46:48 -0500 (EST) Received: from ecc by jaguar.home with local (Exim 4.72) (envelope-from ) id 1PnE7s-00043L-9X for caml-list@inria.fr; Wed, 09 Feb 2011 12:46:48 -0500 Date: Wed, 9 Feb 2011 12:46:48 -0500 From: Eric Cooper To: caml-list@inria.fr Message-ID: <20110209174648.GC14218@localhost> Mail-Followup-To: caml-list@inria.fr References: <670846.47961.qm@web111516.mail.gq1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <670846.47961.qm@web111516.mail.gq1.yahoo.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Scanned-By: mimedefang-cmuscs on 128.2.217.196 Subject: Re: [Caml-list] Localising timestamps On Wed, Feb 09, 2011 at 07:34:39AM -0800, Dario Teixeira wrote: > Basically, I need a function that takes as input a timestamp in UTC and a > time zone specified in the Zoneinfo [1] convention (ex: "Europe/Lisbon"), > and returns the localised version of that timestamp, including a time zone > abbreviation aware of daylight savings. This might not meet your performance requirements, but it's certainly easy to program with Unix.process_open etc. $ TZ=Europe/Paris date --date="2010-07-01 15:30 UTC" +"%F %T %Z" 2010-07-01 17:30:00 CEST The built-in date parser is quite powerful. -- Eric Cooper e c c @ c m u . e d u