I Put three lines with data 19991201 19991202 19991203 Into another buffer loaded the below code into another buffer evaluated the code then switched to the other buffer The en ran the command M-x jh-iso-to-chinese Emacs just switched to the other buffer (C:\EMACS-21.2\BIN\EMACS.EXE) For information about the GNU Project and its goals, type C-h C-p. Loading image...done call-interactively: End of buffer Mark set mouse-minibuffer-check: Minibuffer window is not active [2 times] Loading calendar...done Loading mule-util...done Loading cal-move...done jh-iso-to-chinese This is what is in the messages buffer Is the cursor supposed to be before the dates to be converted or after? Jesper Harder wrote: >swk writes: > > > >>Each line starts with a modified ISO date e.g., 19991203 (YYYYMMDD) >> >>Is there any way to pull the ISO Dates to a file and then append the >>equivilant Chinese dates to a file? >> >> > >I don't think there's any predefined functionality for that. Here's a >suggestion for a way you could implement it. > >Evaluate the following, load the file with the ISO dates in a buffer and >do `M-x jh-iso-to-chinese', which will put the Chinese dates in another >buffer. > > >(defun jh-iso-to-chinese () > (interactive) > (goto-char (point-min)) > (while (re-search-forward "^\\([[:digit:]]\\{4\\}\\)\\([[:digit:]]\\{2\\}\\)\\([[:digit:]]\\{2\\}\\)" nil t) > (let ((str (format "%s\n" (calendar-chinese-date-string > (mapcar 'string-to-int > (list (match-string 1) > (match-string 2) > (match-string 3))))))) > (with-current-buffer (get-buffer-create "*chinese output*") > (insert str)))) > (switch-to-buffer "*chinese output*")) > >