Dates and Times
To assist project planning, TODO items can be labeled with a date and/or a time. The specially formatted string carrying the date and time information is called a timestamp in Org mode. This may be a little confusing because timestamp is often used as indicating when something was created or last changed. However, in Org mode this term is used in a much wider sense.
Timestamps can be used to plan appointments, schedule tasks, set deadlines, track time, and more. The following sections describe the timestamp format and tooling that Org mode provides for common use cases dealing with time and time intervals.
Timestamps
A timestamp is a specification of a date—possibly with a time or
time range—in a special format, either <2003-09-16 Tue> or
<2003-09-16 Tue 09:39> or <2003-09-16 Tue 12:00-12:30> 19.
A timestamp can appear anywhere in the headline or body of an Org tree
entry. Its presence causes entries to be shown on specific dates in
the agenda (see Weekly/daily agenda). We distinguish:
- Plain timestamp; Event; Appointment
A simple timestamp just assigns a date/time to an item. This is just like writing down an appointment or event in a paper agenda. In the agenda display, the headline of an entry associated with a plain timestamp is shown exactly on that date. There can be multiple timestamps in an item.
* Meet Peter at the movies <2006-11-01 Wed 19:15> * Discussion on climate change <2006-11-02 Thu 10:00-12:00> * My days off <2006-11-03 Fri> <2006-11-06 Mon>
- Timestamp with repeater interval
A timestamp may contain a repeater interval, indicating that it applies not only on the given date, but again and again after a certain interval of N hours (h), days (d), weeks (w), months (m), or years (y). The following shows up in the agenda every Wednesday:
* Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
- Diary-style expression entries
For more complex date specifications, Org mode supports using the special expression diary entries implemented in the
Emacs Calendar package20. For example, with optional time:
* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month <%%(diary-float t 4 2) 22:00-23:00>
- Time range
Time range is a timestamp having two time units connected by -
* Discussion on climate change <2006-11-02 Thu 10:00-12:00>
- Time/Date range
Two timestamps connected by -- denote a range. In the agenda, the
headline is shown on the first and last day of the range, and on any
dates that are displayed and fall in the range. The first example
specifies just the dates of the range while the second example
specifies a time range for each date.
** Meeting in Amsterdam <2004-08-23 Mon>--<2004-08-26 Thu> ** This weeks committee meetings <2004-08-23 Mon 10:00-11:00>--<2004-08-26 Thu 10:00-11:00>
- Inactive timestamp
Just like a plain timestamp, but with square brackets instead of angular ones. These timestamps are inactive in the sense that they do not trigger an entry to show up in the agenda.
* Gillian comes late for the fifth time [2006-11-01 Wed]
Creating Timestamps
For Org mode to recognize timestamps, they need to be in the specific format. All commands listed below produce timestamps in the correct format.
-
C-c .(org-timestamp)
Prompt for a date and insert a corresponding timestamp. When point is at an existing timestamp in the buffer, the command is used to modify this timestamp instead of inserting a new one. When this command is used twice in succession, a time range is inserted.
When called with a prefix argument, use the alternative format which
contains date and time. The default time can be rounded to
multiples of 5 minutes. See the option
org-timestamp-rounding-minutes.
With two prefix arguments, insert an active timestamp with the current time without prompting.
-
C-c !(org-timestamp-inactive)
Like C-c ., but insert an inactive timestamp that does
not cause an agenda entry.
-
C-c C-c
Normalize timestamp, insert or fix day name if missing or wrong.
-
C-c <(org-date-from-calendar)
Insert a timestamp corresponding to point date in the calendar.
-
C-c >(org-goto-calendar)
Access the Emacs calendar for the current date. If there is a timestamp in the current line, go to the corresponding date instead.
-
C-c C-o(org-open-at-point)
Access the agenda for the date given by the timestamp or -range at point (see Weekly/daily agenda).
-
S-LEFT(org-timestamp-down-day),S-RIGHT(org-timestamp-up-day)
Change date at point by one day. These key bindings conflict with shift-selection and related modes (see Packages that conflict with Org mode).
-
S-UP(org-timestamp-up),S-DOWN(org-timestamp-down)
On the beginning or enclosing bracket of a timestamp, change its
type. Within a timestamp, change the item under point. Point can
be on a year, month, day, hour or minute. When the timestamp
contains a time range like 15:30-16:30, modifying the first time
also shifts the second, shifting the time block with constant
length. To change the length, modify the second time. Note that if
point is in a headline and not at a timestamp, these same keys
modify the priority of an item (see Priorities). The key bindings
also conflict with shift-selection and related modes (see Packages that conflict with Org mode).
-
C-c C-y(org-evaluate-time-range)
Evaluate a time range by computing the difference between start and end. With a prefix argument, insert result after the time range (in a table: into the following column).
The date/time prompt
When Org mode prompts for a date/time, the default is shown in default date/time format, and the prompt therefore seems to ask for a specific format. But it in fact accepts date/time information in a variety of formats. Generally, the information should start at the beginning of the string. Org mode finds whatever information is in there and derives anything you have not specified from the default date and time. The default is usually the current date and time, but when modifying an existing timestamp, or when entering the second stamp of a range, it is taken from the stamp in the buffer. When filling in information, Org mode assumes that most of the time you want to enter a date in the future: if you omit the month/year and the given day/month is before today, it assumes that you mean a future
date21. If the date has been automatically shifted into the
future, the time prompt shows this with (=>F).
For example, let's assume that today is June 13, 2006. Here is how various inputs are interpreted, the items filled in by Org mode are in bold.
3-2-5 |
⇒ 2003-02-05 |
2/5/3 |
⇒ 2003-02-05 |
14 |
⇒ 2006-06-14 |
12 |
⇒ 2006-07-12 |
2/5 |
⇒ 2007-02-05 |
Fri |
⇒ nearest Friday (default date or later) |
sep 15 |
⇒ 2006-09-15 |
feb 15 |
⇒ 2007-02-15 |
sep 12 9 |
⇒ 2009-09-12 |
12:45 |
⇒ 2006-06-13 12:45 |
22 sept 0:34 |
⇒ 2006-09-22 0:34 |
w4 |
⇒ ISO week for of the current year 2006 |
2012 w4 fri |
⇒ Friday of ISO week 4 in 2012 |
2012-w04-5 |
⇒ Same as above |
Furthermore you can specify a relative date by giving, as the first
thing in the input: a plus/minus sign, a number and a letter—h,
d, w, m or y—to indicate a change in hours, days, weeks,
months, or years. With h the date is relative to the current time,
with the other letters and a single plus or minus, the date is
relative to today at 00:00. With a double plus or minus, it is
relative to the default date. If instead of a single letter, you use
the abbreviation of day name, the date is the Nth such day, e.g.:
+0 |
⇒ today |
. |
⇒ today |
+2h |
⇒ two hours from now |
+4d |
⇒ four days from today |
+4 |
⇒ same as +4d |
+2w |
⇒ two weeks from today |
++5 |
⇒ five days from default date |
+2tue |
⇒ second Tuesday from now |
The function understands English month and weekday abbreviations. If
you want to use un-abbreviated names and/or other languages, configure
the variables parse-time-months and parse-time-weekdays.
Not all dates can be represented in a given Emacs implementation. By
default Org mode forces dates into the compatibility range 1970–2037
which works on all Emacs implementations. If you want to use dates
outside of this range, read the docstring of the variable
org-read-date-force-compatible-dates.
You can specify a time range by giving start and end times or by
giving a start time and a duration (in HH:MM format). Use one or two
dash(es) as the separator in the former case and use + as the
separator in the latter case, e.g.:
11am-1:15pm |
⇒ 11:00-13:15 |
11h-13h15 |
⇒ same as above |
11am--1:15pm |
⇒ same as above |
11am+2:15 |
⇒ same as above |
Parallel to the minibuffer prompt, a calendar is popped up(note: If you
do not need/want the calendar, configure the variable
org-popup-calendar-for-date-prompt.). When you exit the date
prompt, either by clicking on a date in the calendar, or by pressing
RET, the date selected in the calendar is combined with the
information entered at the prompt. You can control the calendar fully
from the minibuffer:
RET |
Choose date at point in calendar. |
mouse-1 |
Select date by clicking on it. |
S-RIGHT |
One day forward. |
S-LEFT |
One day backward. |
S-DOWN |
One week forward. |
S-UP |
One week backward. |
M-S-RIGHT |
One month forward. |
M-S-LEFT |
One month backward. |
> |
Scroll calendar forward by one month. |
< |
Scroll calendar backward by one month. |
M-v |
Scroll calendar forward by 3 months. |
C-v |
Scroll calendar backward by 3 months. |
C-. |
Select today's date22 |
The actions of the date/time prompt may seem complex, but I assure you
they will grow on you, and you will start getting annoyed by pretty
much any other way of entering a date/time out there. To help you
understand what is going on, the current interpretation of your input
is displayed live in the minibuffer(note: If you find this distracting,
turn off the display with org-read-date-display-live.).
Custom time format
Org mode uses the standard ISO notation for dates and times as it is
defined in ISO 8601. If you cannot get used to this and require
another representation of date and time to keep you happy, you can get
it by customizing the variables org-display-custom-times and
org-timestamp-custom-formats.
-
C-c C-x C-t(org-toggle-timestamp-overlays)
Toggle the display of custom formats for dates and times.
Org mode needs the default format for scanning, so the custom date/time format does not replace the default format. Instead, it is put over the default format using text properties. This has the following consequences:
- You cannot place point onto a timestamp anymore, only before or after.
- The
S-UPandS-DOWNkeys can no longer be used to adjust each component of a timestamp. If point is at the beginning of the stamp,S-UPandS-DOWNchange the stamp by one day, just likeS-LEFTS-RIGHT. At the end of the stamp, change the time by one minute. - If the timestamp contains a range of clock times or a repeater, these are not overlaid, but remain in the buffer as they were.
- When you delete a timestamp character-by-character, it only disappears from the buffer after all (invisible) characters belonging to the ISO timestamp have been removed.
- If the custom timestamp format is longer than the default and you are using dates in tables, table alignment will be messed up. If the custom format is shorter, things do work as expected.
Deadlines and Scheduling
A timestamp may be preceded by special keywords to facilitate planning. Both the timestamp and the keyword have to be positioned immediately after the task they refer to.
-
DEADLINE
Meaning: the task—most likely a TODO item, though not necessarily—is supposed to be finished on that date.
On the deadline date, the task is listed in the agenda. In
addition, the agenda for today carries a warning about the
approaching or missed deadline, starting org-deadline-warning-days
before the due date, and continuing until the entry is marked as
done. An example:
*** TODO write article about the Earth for the Guide
DEADLINE: <2004-02-29 Sun>
The editor in charge is [[bbdb:Ford Prefect]]
You can specify a different lead time for warnings for a specific
deadlines using the following syntax. Here is an example with
a warning period of 5 days DEADLINE: <2004-02-29 Sun -5d>. This
warning is deactivated if the task gets scheduled and you set
org-agenda-skip-deadline-prewarning-if-scheduled to t.
-
SCHEDULED
Meaning: you are planning to start working on that task on the given date.
The headline is listed under the given date23. In addition, a reminder that the scheduled date has passed is present in the compilation for today, until the entry is marked as done, i.e., the task is automatically forwarded until completed.
*** TODO Call Trillian for a date on New Years Eve.
SCHEDULED: <2004-12-25 Sat>
If you want to delay the display of this task in the agenda, use
SCHEDULED: <2004-12-25 Sat -2d>: the task is still scheduled on
the 25th but will appear two days later. In case the task contains
a repeater, the delay is considered to affect all occurrences; if
you want the delay to only affect the first scheduled occurrence of
the task, use --2d instead. See org-scheduled-delay-days and
org-agenda-skip-scheduled-delay-if-deadline for details on how to
control this globally or per agenda.
Scheduling an item in Org mode should not be understood in the same way that we understand scheduling a meeting. Setting a date for a meeting is just a simple appointment, you should mark this entry with a simple plain timestamp, to get this item shown on the date where it applies. This is a frequent misunderstanding by Org users. In Org mode, scheduling means setting a date when you want to start working on an action item.
You may use timestamps with repeaters in scheduling and deadline entries. Org mode issues early and late warnings based on the assumption that the timestamp represents the nearest instance of the repeater. However, the use of diary expression entries like
<%%(diary-float t 42)>
in scheduling and deadline timestamps is limited. Org mode does not know enough about the internals of each function to issue early and late warnings. However, it shows the item on each day where the expression entry matches.
Inserting deadlines or schedules
The following commands allow you to quickly insert a deadline or to
schedule an item:24
-
C-c C-d(org-deadline)
Insert DEADLINE keyword along with a stamp. The insertion happens
in the line directly following the headline. Remove any CLOSED
timestamp . When called with a prefix argument, also remove any
existing deadline from the entry. Depending on the variable
org-log-redeadline, take a note when changing an existing
deadline(note: Note the corresponding STARTUP options
logredeadline, lognoteredeadline, and nologredeadline.).
-
C-c C-s(org-schedule)
Insert SCHEDULED keyword along with a stamp. The insertion
happens in the line directly following the headline. Remove any
CLOSED timestamp. When called with a prefix argument, also remove
the scheduling date from the entry. Depending on the variable
org-log-reschedule, take a note when changing an existing
scheduling time(note: Note the corresponding STARTUP options
logreschedule, lognotereschedule, and nologreschedule.).
-
C-c / d(org-check-deadlines)
Create a sparse tree with all deadlines that are either past-due, or
which will become due within org-deadline-warning-days. With
C-u prefix, show all deadlines in the file. With
a numeric prefix, check that many days. For example, C-1 C-c / d shows all deadlines due tomorrow.
-
C-c / b(org-check-before-date)
Sparse tree for deadlines and scheduled items before a given date.
-
C-c / a(org-check-after-date)
Sparse tree for deadlines and scheduled items after a given date.
Note that org-schedule and org-deadline supports setting the date
by indicating a relative time e.g., +1d sets the date to the next
day after today, and --1w sets the date to the previous week before
any current timestamp.
Repeated tasks
Some tasks need to be repeated again and again. Org mode helps to
organize such tasks using a so-called repeater in a DEADLINE,
SCHEDULED, or plain timestamps25. In the following example:
** TODO Pay the rent DEADLINE: <2005-10-01 Sat +1m>
the +1m is a repeater; the intended interpretation is that the task
has a deadline on <2005-10-01> and repeats itself every (one) month
starting from that time. You can use yearly, monthly, weekly, daily
and hourly repeat cookies by using the y, m, w, d and h
letters. If you need both a repeater and a special warning period in
a deadline entry, the repeater should come first and the warning
period last
DEADLINE: <2005-10-01 Sat +1m -3d>
Deadlines and scheduled items produce entries in the agenda when they
are over-due, so it is important to be able to mark such an entry as
done once you have done so. When you mark a DEADLINE or a
SCHEDULED with the TODO keyword DONE, it no longer produces
entries in the agenda. The problem with this is, however, is that
then also the next instance of the repeated entry will not be
active. Org mode deals with this in the following way: when you try
to mark such an entry as done, using C-c C-t, it shifts the
base date of the repeating timestamp by the repeater interval, and
immediately sets the entry state back to TODO(note: In fact, the target
state is taken from, in this sequence, the REPEAT_TO_STATE property,
the variable org-todo-repeat-to-state if it is a string, the
previous TODO state if org-todo-repeat-to-state is t, or the first
state of the TODO state sequence.). In the example above, setting the
state to DONE would actually switch the date like this:
** TODO Pay the rent DEADLINE: <2005-11-01 Tue +1m>
When task contains multiple timestamps with repeater interval, all these timestamps are shifted.
To mark a task with a repeater as DONE, use C-- 1 C-c C-t,
i.e., org-todo with a numeric prefix argument of -1.
A timestamp26 is added under the deadline, to keep a record that you actually acted on the previous instance of this deadline.
As a consequence of shifting the base date, this entry is no longer visible in the agenda when checking past dates, but all future instances will be visible.
With the +1m cookie, the date shift is always exactly one month. So
if you have not paid the rent for three months, marking this entry
DONE still keeps it as an overdue deadline. Depending on the task,
this may not be the best way to handle it. For example, if you forgot
to call your father for 3 weeks, it does not make sense to call him
3 times in a single day to make up for it. Finally, there are tasks,
like changing batteries, which should always repeat a certain time
after the last time you did it. For these tasks, Org mode has
special repeaters ++ and .+. For example:
** TODO Call Father DEADLINE: <2008-02-10 Sun ++1w> Marking this DONE shifts the date by at least one week, but also by as many weeks as it takes to get this date into the future. However, it stays on a Sunday, even if you called and marked it done on Saturday. ** TODO Empty kitchen trash DEADLINE: <2008-02-08 Fri 20:00 ++1d> Marking this DONE shifts the date by at least one day, and also by as many days as it takes to get the timestamp into the future. Since there is a time in the timestamp, the next deadline in the future will be on today's date if you complete the task before 20:00. ** TODO Check the batteries in the smoke detectors DEADLINE: <2005-11-01 Tue .+1m> Marking this DONE shifts the date to one month after today. ** TODO Wash my hands DEADLINE: <2019-04-05 08:00 Fri .+1h> Marking this DONE shifts the date to exactly one hour from now.
You may have both scheduling and deadline information for a specific
task. If the repeater is set for the scheduling information only, you
probably want the repeater to be ignored after the deadline. If so,
set the variable org-agenda-skip-scheduled-repeats-after-deadline to
t. However, any scheduling information without a repeater is no
longer relevant once the task is done, and thus, removed upon
repeating the task. If you want both scheduling and deadline
information to repeat after the same interval, set the same repeater
for both timestamps.
An alternative to using a repeater is to create a number of copies of
a task subtree, with dates shifted in each copy. The command
C-c C-x c was created for this purpose; it is described in
Structure Editing.
Clocking Work Time
Org mode allows you to clock the time you spend on specific tasks in a project. When you start working on an item, you can start the clock. When you stop working on that task, or when you mark the task done, the clock is stopped and the corresponding time interval is recorded. It also computes the total time spent on each
subtree27 of a project. And it remembers a history or tasks recently clocked, so that you can jump quickly between a number of tasks absorbing your time.
To save the clock history across Emacs sessions, use:
(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)When you clock into a new task after resuming Emacs, the incomplete
clock(note: To resume the clock under the assumption that you have
worked on this task while outside Emacs, use (setq org-clock-persist
t).) is retrieved (see Resolving idle time) and you are prompted
about what to do with it.
Clocking commands
-
C-c C-x C-i(org-clock-in)
Start the clock on the current item (clock-in). This inserts the
CLOCK keyword together with a timestamp. If this is not the first
clocking of this item, the multiple CLOCK lines are wrapped into
a LOGBOOK drawer (see also the variable org-clock-into-drawer).
You can also overrule the setting of this variable for a subtree by
setting a CLOCK_INTO_DRAWER or LOG_INTO_DRAWER property. When
called with a C-u prefix argument, select the task from
a list of recently clocked tasks. With two C-u C-u
prefixes, clock into the task at point and mark it as the default
task; the default task is always be available with letter
d when selecting a clocking task. With three C-u C-u C-u prefixes, force continuous clocking by starting the
clock when the last clock stopped.
While the clock is running, Org shows the current clocking time in
the mode line, along with the title of the task. The clock time
shown is all time ever clocked for this task and its children. If
the task has an effort estimate (see Effort Estimates), the
mode line displays the current clocking time against it(note: To add
an effort estimate "on the fly", hook a function doing this to
org-clock-in-prepare-hook.). If the task is a repeating one (see
Repeated tasks), show only the time since the last reset of the
task(note: The last reset of the task is recorded by the
LAST_REPEAT property.). You can exercise more control over show
time with the CLOCK_MODELINE_TOTAL property. It may have the
values current to show only the current clocking instance, today
to show all time clocked on this tasks today—see also the variable
org-extend-today-until, all to include all time, or auto which
is the default(note: See also the variable
org-clock-mode-line-total.). Clicking with mouse-1
onto the mode line entry pops up a menu with clocking options.
-
C-c C-x C-o(org-clock-out)
Stop the clock (clock-out). This inserts another timestamp at the
same location where the clock was last started. It also directly
computes the resulting time in inserts it after the time range as
=>HH:MM. See the variable org-log-note-clock-out for the
possibility to record an additional note together with the clock-out
timestamp(note: The corresponding in-buffer setting is: #+STARTUP:
lognoteclock-out.).
-
C-c C-x C-x(org-clock-in-last)
Re-clock the last clocked task. With one C-u prefix
argument, select the task from the clock history. With two
C-u prefixes, force continuous clocking by starting the
clock when the last clock stopped.
-
C-c C-x C-e(org-clock-modify-effort-estimate)
Update the effort estimate for the current clock task.
-
C-c C-corC-c C-y(org-evaluate-time-range)
Recompute the time interval after changing one of the timestamps.
This is only necessary if you edit the timestamps directly. If you
change them with S-<cursor> keys, the update is
automatic.
-
C-S-UP(org-clock-timestamps-up),C-S-DOWN(org-clock-timestamps-down)
On CLOCK log lines, increase/decrease both timestamps so that the clock duration keeps the same value.
-
S-M-UP(org-timestamp-up),S-M-DOWN(org-timestamp-down)
On CLOCK log lines, increase/decrease the timestamp at point and
the one of the previous, or the next, clock timestamp by the same
duration. For example, if you hit S-M-UP to increase
a clocked-out timestamp by five minutes, then the clocked-in
timestamp of the next clock is increased by five minutes.
Only CLOCK logs created during current Emacs session are
considered when adjusting next/previous timestamp.
-
C-c C-t(org-todo)
Changing the TODO state of an item to DONE automatically stops the clock if it is running in this same item.
-
C-c C-x C-q(org-clock-cancel)
Cancel the current clock. This is useful if a clock was started by mistake, or if you ended up working on something else.
-
C-c C-x C-j(org-clock-goto)
Jump to the headline of the currently clocked in task. With
a C-u prefix argument, select the target task from a list
of recently clocked tasks.
-
C-c C-x C-d(org-clock-display)
Display time summaries for each subtree in the current buffer. This
puts overlays at the end of each headline, showing the total time
recorded under that heading, including the time of any subheadings.
You can use visibility cycling to study the tree, but the overlays
disappear when you change the buffer (see variable
org-remove-highlights-with-change) or press C-c C-c.
The l key may be used in the agenda (see Weekly/daily agenda) to show which tasks have been worked on or closed during
a day.
Important: note that both org-clock-out and org-clock-in-last
can have a global keybinding and do not modify the window disposition.
The clock table
Org mode can produce quite complex reports based on the time clocking information. Such a report is called a clock table, because it is formatted as one or several Org tables.
-
org-clock-report
Insert or update a clock table. When called with a prefix argument, jump to the first clock table in the current document and update it. The clock table includes archived trees.
This command can be invoked by calling
org-dynamic-block-insert-dblock (C-c C-x x) and
selecting "clocktable" (see Dynamic Blocks).
-
C-c C-corC-c C-x C-u(org-dblock-update)
Update dynamic block at point. Point needs to be in the BEGIN
line of the dynamic block.
-
C-u C-c C-x C-u
Update all dynamic blocks (see Dynamic Blocks). This is useful if you have several clock table blocks in a buffer.
-
S-LEFT,S-RIGHT(org-clocktable-try-shift)
Shift the current :block interval and update the table. Point
needs to be in the #+BEGIN: clocktable line for this command. If
:block is today, it is shifted to today-1, etc.
Here is an example of the frame for a clock table as it is inserted
into the buffer by org-clock-report:
#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file #+END:
The #+BEGIN line contains options to define the scope, structure,
and formatting of the report. Defaults for all these options can be
configured in the variable org-clocktable-defaults.
First there are options that determine which clock entries are to be selected:
-
:maxlevel - Maximum level depth to which times are listed in the table. Clocks at deeper levels are summed into the upper level.
-
:scope -
The scope to consider. This can be any of the following:
nilthe current buffer or narrowed region filethe full current buffer subtreethe subtree where the clocktable is located treeNthe surrounding level N tree, for example tree3treethe surrounding level 1 tree agendaall agenda files ("file" ...)scan these files FUNCTIONscan files returned by calling FUNCTION with no argument file-with-archivescurrent file and its archives agenda-with-archivesall agenda files, including archives -
:block -
The time block to consider. This block is specified either absolutely, or relative to the current time and may be any of these formats:
2007-12-31New year eve 2007 2007-12December 2007 2007-W50ISO-week 50 in 2007 2007-Q22nd quarter in 2007 2007the year 2007 today,yesterday,today-Na relative day thisweek,lastweek,thisweek-Na relative week thismonth,lastmonth,thismonth-Na relative month thisyear,lastyear,thisyear-Na relative year
untilnow 28 |
all clocked time ever |
When this option is not set, Org falls back to the value in
org-clock-display-default-range, which defaults to the current
year.
Use S-LEFT or S-RIGHT to shift the time
interval.
-
:tstart -
A time string specifying when to start considering times. Relative
times like
"<-2w>"can also be used. See Matching tags and properties for relative time syntax. -
:tend -
A time string specifying when to stop considering times. Relative
times like
"<now>"can also be used. See Matching tags and properties for relative time syntax. -
:wstart - The starting day of the week. The default is 1 for Monday.
-
:mstart - The starting day of the month. The default is 1 for the first.
-
:step -
Set to
day,week,semimonth,month,quarter, oryearto split the table into chunks. To use this, either:block, or:tstartand:tendare required. -
:stepskip0 -
When non-
nil, do not show steps that have zero time. -
:fileskip0 -
When non-
nil, do not show table sections from files which did not contribute. -
:match - A tags match to select entries that should contribute. See Matching tags and properties for the match syntax.
Then there are options that determine the formatting of the table.
There options are interpreted by the function
org-clocktable-write-default, but you can specify your own function
using the :formatter parameter.
-
:emphasize -
When non-
nil, emphasize level one and level two items. -
:lang -
Language(note: Language terms can be set through the variable
org-clock-clocktable-language-setup.) to use for descriptive cells like "Task". -
:link - Link the item headlines in the table to their origins.
-
:narrow -
An integer to limit the width of the headline column in the Org
table. If you write it like
50!, then the headline is also shortened in export. -
:indent - Indent each headline field according to its level.
-
:filetitle -
Show title in the file column if the file has a
#+title. -
:hidefiles - Hide the file column when multiple files are used to produce the table.
-
:tcolumns -
Number of columns to be used for times. If this is smaller than
:maxlevel, lower levels are lumped into one column. -
:level - Should a level number column be included?
-
:sort -
A cons cell containing the column to sort and a sorting type. E.g.,
:sort (1 . ?a)sorts the first column alphabetically. -
:compact -
Abbreviation for
:level nil :indent t :narrow 40! :tcolumns 1. All are overwritten except if there is an explicit:narrow. -
:timestamp -
A timestamp for the entry, when available. Look for
SCHEDULED,DEADLINE,TIMESTAMPandTIMESTAMP_IAspecial properties (see Special Properties), in this order. -
:tags -
When this flag is non-
nil, show the headline's tags. -
:properties - List of properties shown in the table. Each property gets its own column.
-
:inherit-props -
When this flag is non-
nil, the values for:propertiesare inherited. -
:formula -
Content of a
TBLFMkeyword to be added and evaluated. As a special case,:formula %adds a column with % time. If you do not specify a formula here, any existing formula below the clock table survives updates and is evaluated. -
:formatter - A function to format clock data and insert it into the buffer.
To get a clock summary of the current level 1 tree, for the current day, you could write:
#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t #+END:
To use a specific time range you could write(note: Note that all parameters must be specified in a single line—the line is broken here only to fit it into the manual.)
#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
:tend "<2006-08-10 Thu 12:00>"
#+END:
A range starting a week ago and ending right now could be written as
#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>" #+END:
A summary of the current subtree with % times would be
#+BEGIN: clocktable :scope subtree :link t :formula % #+END:
A horizontally compact representation of everything clocked during last week would be
#+BEGIN: clocktable :scope agenda :block lastweek :compact t #+END:
Resolving idle time and continuous clocking
Resolving idle time
If you clock in on a work item, and then walk away from your computer—perhaps to take a phone call—you often need to "resolve" the time you were away by either subtracting it from the current clock, or applying it to another one.
By customizing the variable org-clock-idle-time to some integer,
such as 10 or 15, Emacs can alert you when you get back to your
computer after being idle for that many minutes29, and ask what you want to do with the idle time. There will be a question waiting for you when you get back, indicating how much idle time has passed constantly updated with the current amount, as well as a set of choices to correct the discrepancy:
-
k
To keep some or all of the minutes and stay clocked in, press
k. Org asks how many of the minutes to keep. Press
RET to keep them all, effectively changing nothing, or
enter a number to keep that many minutes.
-
K
If you use the shift key and press K, it keeps however
many minutes you request and then immediately clock out of that
task. If you keep all of the minutes, this is the same as just
clocking out of the current task.
-
s
To keep none of the minutes, use s to subtract all the
away time from the clock, and then check back in from the moment you
returned.
-
S
To keep none of the minutes and just clock out at the start of the
away time, use the shift key and press S. Remember that
using shift always leave you clocked out, no matter which option you
choose.
-
C
To cancel the clock altogether, use C. Note that if
instead of canceling you subtract the away time, and the resulting
clock amount is less than a minute, the clock is still canceled
rather than cluttering up the log with an empty entry.
What if you subtracted those away minutes from the current clock, and now want to apply them to a new clock? Simply clock in to any task immediately after the subtraction. Org will notice that you have subtracted time "on the books", so to speak, and will ask if you want to apply those minutes to the next task you clock in on.
There is one other instance when this clock resolution magic occurs. Say you were clocked in and hacking away, and suddenly your cat chased a mouse who scared a hamster that crashed into your UPS's power button! You suddenly lose all your buffers, but thanks to auto-save you still have your recent Org mode changes, including your last clock in.
If you restart Emacs and clock into any task, Org will notice that you have a dangling clock which was never clocked out from your last session. Using that clock's starting time as the beginning of the unaccounted-for period, Org will ask how you want to resolve that time. The logic and behavior is identical to dealing with away time due to idleness; it is just happening due to a recovery event rather than a set amount of idle time.
You can also check all the files visited by your Org agenda for
dangling clocks at any time using M-x org-resolve-clocks RET (or C-c C-x C-z).
Continuous clocking
You may want to start clocking from the time when you clocked out the
previous task. To enable this systematically, set
org-clock-continuously to non-nil. Each time you clock in, Org
retrieves the clock-out time of the last clocked entry for this
session, and start the new clock from there.
If you only want this from time to time, use three universal prefix
arguments with org-clock-in and two C-u C-u with
org-clock-in-last.
Clocking out automatically after some idle time
When you often forget to clock out before being idle and you don't
want to manually set the clocking time to take into account, you can
set org-clock-auto-clockout-timer to a number of seconds and add
(org-clock-auto-clockout-insinuate) to your .emacs file.
When the clock is running and Emacs is idle for more than this number of seconds, the clock will be clocked out automatically.
Use M-x org-clock-toggle-auto-clockout RET to temporarily turn this
on or off.
Effort Estimates
If you want to plan your work in a very detailed way, or if you need to produce offers with quotations of the estimated work effort, you may want to assign effort estimates to entries. If you are also clocking your work, you may later want to compare the planned effort with the actual working time, a great way to improve planning estimates.
Effort estimates are stored in a special property EFFORT. Multiple
formats are supported, such as 3:12, 1:23:45, or 1d3h5min; see
the file org-duration.el for more detailed information about the
format.
You can set the effort for an entry with the following commands:
-
C-c C-x e(org-set-effort)
Set the effort estimate for the current entry. With a prefix
argument, set it to the next allowed value—see below. This
command is also accessible from the agenda with the e
key.
-
C-c C-x C-e(org-clock-modify-effort-estimate)
Modify the effort estimate of the item currently being clocked.
Clearly the best way to work with effort estimates is through column
view (see Column View). You should start by setting up discrete
values for effort estimates, and a COLUMNS format that displays
these values together with clock sums—if you want to clock your
time. For a specific buffer you can use:
#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM
or, even better, you can set up these values globally by customizing
the variables org-global-properties and
org-columns-default-format. In particular if you want to use this
setup also in the agenda, a global setup may be advised.
The way to assign estimates to individual items is then to switch to
column mode, and to use S-RIGHT and S-LEFT to
change the value. The values you enter are immediately summed up in
the hierarchy. In the column next to it, any clocked time is
displayed.
If you switch to column view in the daily/weekly agenda, the effort
column summarizes the estimated work effort for each day(note: Please
note the pitfalls of summing hierarchical data in a flat list (see
Using Column View in the Agenda).), and you can use this to find
space in your schedule. To get an overview of the entire part of the
day that is committed, you can set the option
org-agenda-columns-add-appointments-to-effort-sum. The appointments
on a day that take place over a specified time interval are then also
added to the load estimate of the day.
Effort estimates can be used in secondary agenda filtering that is
triggered with the / key in the agenda (see Commands in the Agenda Buffer). If you have these estimates defined consistently,
two or three key presses narrow down the list to stuff that fits into
an available time slot.
Taking Notes with a Relative Timer
Org provides two types of timers. There is a relative timer that counts up, which can be useful when taking notes during, for example, a meeting or a video viewing. There is also a countdown timer.
The relative and countdown are started with separate commands.
-
C-c C-x 0(org-timer-start)
Start or reset the relative timer. By default, the timer is set
to 0. When called with a C-u prefix, prompt the user for
a starting offset. The prompt will default to a timer string at
point (if any), providing a convenient way to restart taking notes
after a break in the process. When called with a double prefix
argument C-u C-u, change all timer strings in the active
region by a certain amount. This can be used to fix timer strings
if the timer was not started at exactly the right moment.
-
C-c C-x ;(org-timer-set-timer)
Start a countdown timer. The user is prompted for a duration.
org-timer-default-timer sets the default countdown value. Giving
a numeric prefix argument overrides this default value. This
command is available as ; in agenda buffers.
Once started, relative and countdown timers are controlled with the same commands.
-
C-c C-x .(org-timer)
Insert a relative time into the buffer. The first time you use this, the timer starts. Using a prefix argument restarts it.
-
C-c C-x -(org-timer-item)
Insert a description list item with the current relative time. With a prefix argument, first reset the timer to 0.
-
M-RET(org-insert-heading)
Once the timer list is started, you can also use M-RET to
insert new timer items.
-
C-c C-x \,(org-timer-pause-or-continue)
Pause the timer, or continue it if it is already paused.
-
C-c C-x _(org-timer-stop)
Stop the timer. After this, you can only start a new timer, not continue the old one. This command also removes the timer from the mode line.
Footnotes
-
19
The Org date format is inspired by the standard ISO 8601 date/time format. To use an alternative format, see Custom time format. The day name is optional when you type the date yourself. However, any date inserted or modified by Org adds that day name, for reading convenience.
Backrefs: 1
-
20
When working with the standard diary expression functions, you need to be very careful with the order of the arguments. That order depends evilly on the variable
calendar-date-style. For example, to specify a date December 1, 2005, the call might look like(diary-date 12 1 2005)or(diary-date 1 12 2005)or(diary-date 2005 12 1), depending on the settings. This has been the source of much confusion. Org mode users can resort to special versions of these functions, namelyorg-date,org-anniversary,org-cyclic, andorg-block. These work just like the correspondingdiary-functions, but with stable ISO order of arguments (year, month, day) wherever applicable, independent of the value ofcalendar-date-style.Backrefs: 1
-
21
See the variable
org-read-date-prefer-future. You may set that variable to the symboltimeto even make a time before now shift the date to tomorrow.Backrefs: 1
-
22
You can also use the calendar command
.to jump to today's date, but if you are inserting an hour specification for your timestamp,.will then insert a dot after the hour. By contrast,C-.will always jump to today's date.Backrefs: 1
-
23
It will still be listed on that date after it has been marked as done. If you do not like this, set the variable
org-agenda-skip-scheduled-if-done.Backrefs: 1
-
24
The
SCHEDULEDandDEADLINEdates are inserted on the line right below the headline. Do not put any text between this line and the headline.Backrefs: 1
-
25
Org does not repeat inactive timestamps, however. See Timestamps.
Backrefs: 1
-
26
You can change this using the option
org-log-repeat, or theSTARTUPoptionslogrepeat,lognoterepeat, andnologrepeat. Withlognoterepeat, you will also be prompted for a note.Backrefs: 1
-
27
Clocking only works if all headings are indented with less than 30 stars. This is a hard-coded limitation of
lmaxinorg-clock-sum.Backrefs: 1
-
28
When using
:step,untilnowstarts from the beginning of 2003, not the beginning of time.Backrefs: 1
-
29
On computers using macOS, idleness is based on actual user idleness, not just Emacs's idle time. For X11, you can install a utility program
x11idle.c, available in theorg-contrib/repository, or install the xprintidle package and set it to the variableorg-clock-x11idle-program-nameif you are running Debian, to get the same general treatment of idleness. On other systems, idle time refers to Emacs idle time only.Backrefs: 1