• Resolved Sixtel

    (@sixtel)


    Greetings,

    Can someone help me figure out how to subtract from an hour from an events start time?

    Basically I want to do something like this:
    $start_time = (tribe_get_start_date(null, false, $time_format) – 1);

    but…you know..correctly.

    Currently I am making it work but I don’t like the way I am doing it. I’m casting $start_time to a double and then subtracting an hour from it. It works ok when it’s on the hour but I’m worried about whats going to happen for events that start at say 7:30.

    Ideally I would like to subtract an hour before all the internal tribe converting from time format to string format happens.

    Thanks for any ideas on this!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey @sixtel,

    Thanks for reaching out!

    Are you needing to subtract 1 hour from the event start date because they are showing to be 1 hour late?

    Unfortunately we don’t support plugin customizations here which is what this would be categorized as however I can note that if you are having issues with times and timezones, this article working with time zones from our knowledge base can be very helpful.

    Take care,
    Ed

    Thread Starter Sixtel

    (@sixtel)

    Well, what I need is an entirely new variable for a Door Time category.

    Using Advanced Custom Fields I created a new field and I can grab it in the tribe .php files and output it.

    What I want to do is to set a default time in case the field has not been filled out that takes the official start time and subtracts one hour from it. I actually am doing that, but I’m doing it oddly and I’d rather just do the math on whatever timestamp var type is being used and then output that (basically, so it properly preserves the minutes and AM/PM).

    I hope that makes sense.

    Hey @sixtel,

    I’d say that you are on the right track with tribe_get_start_date — there’s not really a concrete way to do this with the standard version of The Events Calendar however it can be done with the Pro version of our plugin.

    Here’s an article describing the functionality → https://theeventscalendar.com/knowledgebase/pro-additional-fields/

    Take care,
    Ed ??

    Hey there! This thread has been inactive for a while so we’re going to go ahead and mark it Resolved. Please feel free to open a new thread if any other questions come up and we’d be happy to help. ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘subtract from events start time’ is closed to new replies.