,-- On Fri, 09 Sep 2005 09:45:48 +0200, Stefan Reich�r wrote:
| 
| Hi Sacha!
| 
| > As I was trying to figure out how to do weekly planning, I realized I
| > didn't know a nice, easy Emacs function for finding the current week
| > number. Would anyone happen to have that handy? Alternatively, I could
| > use something like Week.2005.09.05 to signify the week starting on
| > 2005.09.05 (depending on calendar-week-start-day).
| 
| Here is my function to accomplish that task:
| 
| (defun calendar-week-number (date)
|   "Return the week number for DATE.
| The week starts on MONDAY."
|   (let* ((year (extract-calendar-year date))
|          (day-number (calendar-day-number date))
|          (day-of-week-first-day (calendar-day-of-week (list 1 1 year)))
|          (adjust))
|     (when (eq 0 day-of-week-first-day)
|       (setq day-of-week-first-day 7))
|     (setq adjust (% (- 9 day-of-week-first-day) 8))
|     (if (< day-number adjust)
|         (calendar-week-number (list 12 31 (- year 1)))
|       (+ 1 (/ (- day-number adjust) 7)))))
| 
| It would be nice to integrate that function in emacs. What do you think?

What about

(format-time-string "%U") or
(format-time-string "%V") or
(format-time-string "%W")

Frederik


_______________________________________________
emacs-wiki-discuss mailing list
emacs-wiki-discuss@nongnu.org
http://lists.nongnu.org/mailman/listinfo/emacs-wiki-discuss

Reply via email to