Time format used in .ics file?

21,620

With Java you could use

DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss");

See more at iCalendar RFC 5545

Share:
21,620
Admin
Author by

Admin

Updated on July 09, 2022

Comments

  • Admin
    Admin almost 2 years

    I am creating an .ics file in Java, and I need to know what date and time format to use.

    Here is the current format of my ics file:

    BEGIN:VCALENDAR
    VERSION:2.0
    BEGIN:VEVENT
    DTSTART:20120901T180000
    DTEND:20120901T183000
    SUMMARY:my birthday
    LOCATION:Bangalore
    DESCRIPTION:Every one is welcome..!! time to party
    PRIORITY:3
    END:VEVENT
    END:VCALENDAR
    

    I used ISO_DATETIME_TIME_ZONE_FORMAT to convert my date to the required format, but it returned 2012-09-01T18:00:00+00:00

    What is the date format used in the DTSTART and DTEND values? Specifically, how can I format this properly in Java?

  • Admin
    Admin about 12 years
    Thank you, but i had a look at that, and it seemed much simpler to just write the ics file onto an outputsteam and download it. also im trying to avoid using a third-party library, i just need to know which format the date and time should be parsed in.
  • smooth reggae
    smooth reggae about 12 years
    A little googling will get you the answer; one the results says The iCal Date format is in the form of yyyymmddThhmmss; @roger-lindsjo's note above has the pattern you can use with SimpleDateFormat to parse it