[Top][All Lists]

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

Re: If clause depending on name of the day

From: PJ Weisberg
Subject: Re: If clause depending on name of the day
Date: Tue, 3 Apr 2012 13:05:00 -0700

On Tue, Apr 3, 2012 at 12:32 PM, Lars Ljung <address@hidden> wrote:
> "Sven Bretfeld" <address@hidden> writes:
>> Is it possible to have an if-condition that looks for the current day?
>> So that the then-expression does something different on Tuesday than on
>> Friday?
> (nth 6 (decode-time)) returns 0-6 for Sunday-Saturday.

So you could do something like this:

(require 'cl)
(case (nth 6 (decode-time))
   (message "Today is Sunday"))
  ((1 3 5)
   (message "Today is Monday, Wednesday, or Friday"))
   (message "Today is Tuesday"))
   (message "It's some other day.")))


Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.

reply via email to

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