Hyphen between date and time?

Home Forums Calendar Products Events Calendar PRO Hyphen between date and time?

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #30942
    Adam
    Participant

    Hi,
    Currently on my homepage I’m pulling in events into a carousel and am displaying the event time and date using the following:
    Many thanks,
    Adam.

    #30943
    Adam
    Participant


    "/>

    #30944
    Adam
    Participant

    How can I post php code on this forum?

    #31011
    Adam
    Participant

    Can anyone help here please?
    I need to know how to add php code so I can ask my question properly.

    #31046
    Barry
    Member

    Hi Adam, sorry about the confusion! Please use a service like Pastebin or Gist to share your code. We’re aware this is a pain and a change is in the works to improve things, but for the time being Pastebin/Gist/similar services offer the best way to do this.

    #31185
    Adam
    Participant

    Thanks Barry, my code is here:
    http://pastebin.com/gdQdG1GG

    Would love to know how I could add a hyphen between the date & time like so:
    January 23, 2013 – 1:45 pm

    #31240
    Barry
    Member

    The date format follows the same conventions as used by PHP’s date() function so the current pattern you are using Y-m-d-h:i:s probably needs to change to F j, Y – h:i a … does that help here?

    #31318
    Adam
    Participant

    Thanks Barry, I’ve tried this: ‘M j, Y – h:i a’, but it spits out the following:
    Jan 23, 2013 – 01:45 pm 1:45 pm

    Do you know why the time would be displaying twice at all?

    #31320
    Adam
    Participant

    A-ha, I’ve managed to get what I want with the following:
    echo tribe_get_start_date( $post->ID, false, ‘M j, Y – g:i a’);

    Thank you for pointing me in the right direction! I really need to start learning php… 🙂

    #31321
    Barry
    Member

    Yes, if the second parameter is something other than false (or a value that evaluates as false, such as zero) then the time will be appended.

    tribe_get_start_date(null, false, 'M j, Y - h:i a');

    The above works for me and doesn’t show the time twice. Can you confirm if this is the same as your code?

    #31322
    Barry
    Member

    OK, posted at the same time there! But yep sounds like you’re on track, so I will close this thread now.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Hyphen between date and time?’ is closed to new replies.