Custom Fields
Re-Envisioned
Support General Countdown using date and time field?

This topic contains 2 replies, has 3 voices, and was last updated by  Anh Tran 8 months, 1 week ago.

  • Creator
    Topic
  • #10135

    alisha
    Participant

    Hello,
    Is it possible to show how many days and minutes remaining from the match date and time?
    <?php $date = rwmb_meta( ‘pb_match_date’,”, $post->ID);
    $match_time = rwmb_meta( ‘pb_match_time’, ”, get_the_ID() ); ?>
    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #10142

    davidrknowles
    Participant

    The hard part of this is getting the users time, and this could depend on timezone, DST etc.

    The only way I have found this possible is using JS to get browser information and then compare it with the server output. You will have to pass the server output to the DOM or use AJAX to make the communication with the server.

    Bit of a challenge, I was doing this for a listing site for displaying opening hours and notifying the users if the business was open, I have put it on the back burner for now.

    #10149

    Anh Tran
    Keymaster

    Thanks David for your help. I guess Alisha already have start date and end date and just need to calculate the difference between them. I think this thread on Stack Overflow can answer this quite well:

    https://stackoverflow.com/q/676824

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.