Custom Fields
Support General Countdown using date and time field?

  • Creator
  • #10135

    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() ); ?>

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

    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.

    Anh Tran

    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:

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.