6

C-c . could insert the timestamp of the current date and C-u C-c . insert the current datetime.

I find it very difficult to insert an arbitrary datetime.

enter image description here

Operations over Calendar are invalid since the focus stay on the mini-buffer.

A work-around solution to insert <2019-08-09 Fri>

  1. M-x calendar to select year 2019, month of August, Day of 09
  2. C-x o switch to other buffer from the calendar
  3. C-c < (org-date-from-calendar)

Is there a handy way to insert a specified timestamp? or how could scroll the Calendar after strike C-u C-c .?

Drew
  • 75,699
  • 9
  • 109
  • 225
AbstProcDo
  • 1,231
  • 5
  • 15

4 Answers4

6

To insert a timestamp four months from today, press: C-c . +4m RET and the +4m cookie shifts the date for you. Likewise, use -4m to insert four months before today (y, m, w, and d letters are all valid).

Use S-arrows, <, and > for navigation. See the manual for more information.

jagrg
  • 3,824
  • 4
  • 19
  • add the reference [8.2.1 The date/time prompt](https://orgmode.org/manual/The-date_002ftime-prompt.html#The-date_002ftime-prompt) – AbstProcDo Mar 09 '20 at 12:53
1

I wrote this for one of my libraries. It returns a string formatted as an Org time stamp.

defun my-org-time-stamp (&optional time inactive)
  "Return an Org time stamp.

TIME is specified as (HIGH LOW USEC PSEC), as returned 
by `current-time' or `file-attributes'. The 
`org-current-time' is used unless non-nil.

INACTIVE means use square brackets instead of angular 
ones, so that the stamp will not contribute to the agenda.

Examples:
(my-org-time-stamp nil t)
\"[2020-01-27 Mon 21:37]\"
(my-org-time-stamp nil nil)
\"<2020-01-27 Mon 21:38>\""
(let ((time (or time (org-current-time))))
(if inactive
        (org-format-time-string "[%F %a %H:%M]" time)
(org-format-time-string "<%F %a %H:%M>" time))))

Using this, you could create a function which prompts for the time and then inserts the resulting time stamp.

Lorem Ipsum
  • 4,327
  • 2
  • 14
  • 35
1

@jagrg has helpfully answered the question you probably really meant to ask, namely "how do I enter the date exactly seven months ago?" You should and did accept that answer.

For completeness, to answer the question as asked, typing the following 15 individual keystrokes in order:

C-c
.
1
9
-
8
-
9
SPC
1
2
:
3
4
RET

will insert <2019-08-09 Fri 12:34>.

Notes:

  • In this case, the calendar's default three-month display is no help. In other cases, you should use the calendar window for reference, not input. Or simply ignore it; I rarely even glance at the calendar when entering dates and times.
  • Entering a time works even without the C-u prefix; the only difference is that the initial suggested completion does not display a time.
Phil Hudson
  • 1,651
  • 10
  • 13
0

jajrg has the info you want.

but just to add a small detail:

C-c . prompts you to insert a active timestamp. it appears in your agenda and is surrounded by < >.

C-c ! prompts you to insert an inactive timestamp. it doesn't appear in your agenda and is surrounded by [ ].

once created, you can also change the date by ensuring point is on the timestamp and using S-<right> and S-<left> to shift back/forward by one day, and S-<up> S-<down> do move by one unit of whatever point is currently over (year, month, or day, also hour and minute if you have them).

(full info: https://orgmode.org/manual/Creating-Timestamps.html#Creating-Timestamps.)

user27075
  • 488
  • 3
  • 11