help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs Calc: converting FROM Unix Time, unrecognized time zone


From: Jay Belanger
Subject: Re: Emacs Calc: converting FROM Unix Time, unrecognized time zone
Date: Fri, 04 May 2007 10:31:32 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

Alan <lngndvs@gmail.com> writes:
...
> I would like to be able to extract only decimal hours from the date
> string "2007-05-05 14:30".  Is this possible?  I can easily do it by
> grabbing the minutes form and dividing by 60 in calc.  Of course, a
> more direct approach would be helpful.

't P' (`calc-date-part') will get it for you.
Enter the date with algebraic notation:
<2007-05-05 14:30>
then, to get the hours, either `C-u 4 t P' or 
`t P', and then type `4' at the prompt (which will also tell you which
number to type to get the date parts: `1' for year,..., `4' for hours).

> I am now struggling with how to set the time zone variable.  I guess
> I can use Sydney time, or GMT-10?

A list of values that Calc recognizes is in the "Time Zones" section
of the Calc manual.  Perhaps the TimeZone variable should be made
customizable; for now, `s T' will take you to a buffer to set the
variable, and `s p TimeZone' will store the value permanently in your
calc initialization file.

> The calc manual says:
>     "f your system does not have a suitable `date' command, you may
> wish to put a `(setq var-TimeZone ...)' in your       Emacs
> initialization file to set the time"
>
> This variable is undocumented in emacs 23.0.0 (Gentoo GNU/Linux).

It's not documented as an Emacs lisp variable (although I guess it
should be), but it is documented as a Calc variable.  It is in the
variable index of the Calc manual under "TimeZone".  As a Calc
variable, it is "TimeZone", but to deal with it directly from elisp,
you need to use `var-TimeZone'.  (In general, the Calc variable `foo'
corresponds to the lisp variable `var-foo'.)

Jay


reply via email to

[Prev in Thread] Current Thread [Next in Thread]