ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Convert to military time

August 24, 2009 1:17pm

Subscribe [2]
  • #1 / Aug 24, 2009 1:17pm

    Brad Morse

    428 posts

    I have the members enter in events using the HH:MM PM/AM format, which works great.

    I am creating an xml file that will be used w/ a third party app, and that app uses military time.

    Here is the code I have for the xml file

    <EventDate>{entry_date format="%Y-%m-%d"}</EventDate> 
    <StartTime>{entry_date format="%h:%i:00"}</StartTime>
    <EndTime>{expiration_date format="%h:%i:00"}</EndTime>

    here is a screen shot of a weblog entry entry_date/expiration_date: http://i31.tinypic.com/28her6g.png

    here is a screen shot of what it displays in the file when created: http://i32.tinypic.com/10rld6t.png

    The 11:00 part is fine, since it is 11:00 AM, but the 03:00 in military time really means 3 AM, which is not correct, as you’ll see it is expiring for 03:00 PM within this screen shot http://i31.tinypic.com/28her6g.png

    I do not want to alter how entry_date & expiration_date’s are being entered, I just want it to display as military time within the xml file.

  • #2 / Aug 24, 2009 1:20pm

    Ingmar

    29245 posts

    Use

    %H

    for the hour. Been doing it for years 😊

  • #3 / Aug 24, 2009 1:24pm

    Brad Morse

    428 posts

    Oops, should of seen that.

    Thanks!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases