comparison lisp/calendar/icalendar.el @ 93376:bc4871e6df44

(icalendar--datetime-to-american-date): New name for icalendar--datetime-to-noneuropean-date. Make old name obsolete alias. (icalendar--datetime-to-iso-date): New function. (icalendar--datetime-to-diary-date): Doc fix. Respect calendar-date-style if bound.
author Glenn Morris <rgm@gnu.org>
date Sat, 29 Mar 2008 02:44:44 +0000
parents fe7a1170342d
children adddea858c0d
comparison
equal deleted inserted replaced
93375:0d954ec4d752 93376:bc4871e6df44
622 nil 622 nil
623 nil 623 nil
624 ;;(or (nth 6 time1) (nth 6 time2)) ;; FIXME? 624 ;;(or (nth 6 time1) (nth 6 time2)) ;; FIXME?
625 ))) 625 )))
626 626
627 (defun icalendar--datetime-to-noneuropean-date (datetime &optional separator) 627 (defun icalendar--datetime-to-american-date (datetime &optional separator)
628 "Convert the decoded DATETIME to non-european-style format. 628 "Convert the decoded DATETIME to American-style format.
629 Optional argument SEPARATOR gives the separator between month, 629 Optional argument SEPARATOR gives the separator between month,
630 day, and year. If nil a blank character is used as separator. 630 day, and year. If nil a blank character is used as separator.
631 Non-European format: \"month day year\"." 631 American format: \"month day year\"."
632 (if datetime 632 (if datetime
633 (format "%d%s%d%s%d" (nth 4 datetime) ;month 633 (format "%d%s%d%s%d" (nth 4 datetime) ;month
634 (or separator " ") 634 (or separator " ")
635 (nth 3 datetime) ;day 635 (nth 3 datetime) ;day
636 (or separator " ") 636 (or separator " ")
637 (nth 5 datetime)) ;year 637 (nth 5 datetime)) ;year
638 ;; datetime == nil 638 ;; datetime == nil
639 nil)) 639 nil))
640
641 (define-obsolete-function-alias 'icalendar--datetime-to-noneuropean-date
642 'icalendar--datetime-to-american-date "icalendar 0.19")
640 643
641 (defun icalendar--datetime-to-european-date (datetime &optional separator) 644 (defun icalendar--datetime-to-european-date (datetime &optional separator)
642 "Convert the decoded DATETIME to European format. 645 "Convert the decoded DATETIME to European format.
643 Optional argument SEPARATOR gives the separator between month, 646 Optional argument SEPARATOR gives the separator between month,
644 day, and year. If nil a blank character is used as separator. 647 day, and year. If nil a blank character is used as separator.
651 (or separator " ") 654 (or separator " ")
652 (nth 5 datetime)) ;year 655 (nth 5 datetime)) ;year
653 ;; datetime == nil 656 ;; datetime == nil
654 nil)) 657 nil))
655 658
659 (defun icalendar--datetime-to-iso-date (datetime &optional separator)
660 "Convert the decoded DATETIME to ISO format.
661 Optional argument SEPARATOR gives the separator between month,
662 day, and year. If nil a blank character is used as separator.
663 ISO format: (year month day)."
664 (if datetime
665 (format "%d%s%d%s%d" (nth 5 datetime) ;year
666 (or separator " ")
667 (nth 4 datetime) ;month
668 (or separator " ")
669 (nth 3 datetime)) ;day
670 ;; datetime == nil
671 nil))
672
656 (defun icalendar--datetime-to-diary-date (datetime &optional separator) 673 (defun icalendar--datetime-to-diary-date (datetime &optional separator)
657 "Convert the decoded DATETIME to diary format. 674 "Convert the decoded DATETIME to diary format.
658 Optional argument SEPARATOR gives the separator between month, 675 Optional argument SEPARATOR gives the separator between month,
659 day, and year. If nil a blank character is used as separator. 676 day, and year. If nil a blank character is used as separator.
660 Call icalendar--datetime-to-(non)-european-date according to 677 Call icalendar--datetime-to-*-date according to the
661 value of `european-calendar-style'." 678 value of `calendar-date-style' (or the older `european-calendar-style')."
662 (if european-calendar-style 679 (funcall (intern-soft (format "icalendar--datetime-to-%s-date"
663 (icalendar--datetime-to-european-date datetime separator) 680 (if (boundp 'calendar-date-style)
664 (icalendar--datetime-to-noneuropean-date datetime separator))) 681 calendar-date-style
682 (if (with-no-warnings european-calendar-style)
683 'european
684 'american))))
685 datetime separator))
665 686
666 (defun icalendar--datetime-to-colontime (datetime) 687 (defun icalendar--datetime-to-colontime (datetime)
667 "Extract the time part of a decoded DATETIME into 24-hour format. 688 "Extract the time part of a decoded DATETIME into 24-hour format.
668 Note that this silently ignores seconds." 689 Note that this silently ignores seconds."
669 (format "%02d:%02d" (nth 2 datetime) (nth 1 datetime))) 690 (format "%02d:%02d" (nth 2 datetime) (nth 1 datetime)))