- 0
Convert Video Duration Number to Time with PHP or jQuery
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By Ixion · Posted
Given only Volume license customers and specific resellers can obtain the LTSC versions legitimately it seems likely that this has been tinkered with quite a lot! -
By Hamid Ganji · Posted
Apple CEO Tim Cook confirms looming price hikes due to memory shortages by Hamid Ganji Image via Apple Memory and chip shortages have led to significant price increases for electronics over the past year, and it seems that more hikes are on the way for upcoming smartphones and computers. Apple CEO Tim Cook has confirmed that the company is planning to increase the prices of some of its products due to the ongoing memory and storage shortages. In an interview with The Wall Street Journal, Cook confirmed the looming price hikes for Apple’s future products, adding that “Unfortunately, price increases are unavoidable.” He also said the company is doing its best to “mitigate the huge increases that are being passed to us, and we’ve been trying to shield our customers from the increases, but the situation has become unsustainable.” The Apple CEO also noted that the allocation of a large portion of memory chips to AI companies has contributed to shortages in the market, resulting in lower supply at a time when demand for devices remains high. “We definitely need memory pricing and supply to return to reasonable levels for consumer products. That’s the bottom line,” Cook said. Cook also added that Apple is ready to use its vast cash reserves to help boost supply in the market because additional production capacity is needed. While he declined to specify how Apple plans to do that, he said the company will not build its own memory and storage factories despite its financial resources and silicon expertise. Cook did not provide further details on the scale of the price increases or which Apple products would be affected, though iPads and Macs could see higher prices sooner than other products. Apple’s next product launch event is scheduled for September, when the company is expected to unveil the iPhone 18 Pro, iPhone 18 Pro Max, and its first foldable iPhone. It remains unclear whether the upcoming iPhones will be affected by the price increases, but given the current memory shortage, higher prices seem increasingly likely. There is currently no clear timeline for the end of the memory shortage. Samsung, one of the world’s three largest memory chip manufacturers, recently said the shortage could persist for several more years. -
By AgusL · Posted
Downloads does not equal actual usage, even less when the app is pre-installed in some Galaxy phones. -
By AgusL · Posted
+1000 to this, don't understand why they added that margin around the top bar, even the close button is a PITA to click without aiming. Ofc, this is just preview and hopefully they will revert such odd UX decision before hitting final version. -
By THE END · Posted
so the people who bought this will get a refund?
-
-
Recent Achievements
-
eurospharma62 earned a badge
One Month Later
-
With What earned a badge
Week One Done
-
Harris Gilbert earned a badge
Week One Done
-
Vincian earned a badge
One Month Later
-
Jocimo earned a badge
First Post
-
-
Popular Contributors
-
Tell a friend
Question
Mr.XXIV
I'm loading the YouTube API by jQuery + JSON to get the video info of it's views and duration.
The duration number for example is 210 sample, but in actually time, it's 3:30. :)
The problem is, I'm not sure how to come by to converting the numbers to actually time, not even with PHP's strtotime since I believe jQuery would load too late for that. (Or I don't know at all.) :p
<div id="sidebar"> <h3>Related Videos</h3> <ul id="related-videos"> <?php $the_query = new WP_Query( array( 'posts_per_page' => '5', 'post_format' => 'post-format-video','category_name' => 'hip-hop') ); while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <li> <a href="<?php the_permalink();?>"> <div class="side-thumb"><?php the_post_thumbnail('small'); ?></div> <?php the_title(); ?><br /> <script type="text/javascript"> $(document).ready(function () { $.getJSON('http://gdata.youtube.com/feeds/api/videos/<?php echo getYouTubeIdFromURL(get_post_meta($post->ID,'video',true)); ?> ?v=2&alt=jsonc',function(data,status,xhr){ $("#yt_time-<?php echo get_the_ID(); ?>").html(data.data.duration); $("#yt_views-<?php echo get_the_ID(); ?>").html(data.data.viewCount); }); }); </script> <span><div class="yt">Duration: </div><div id="yt_time-<?php echo get_the_ID(); ?>" class="yt"></div><div class="yt"> | </div><div class="yt">Views: </div><div id="yt_views-<?php echo get_the_ID(); ?>"class="yt"></div></span> </a> </li> <?php endwhile;wp_reset_postdata();?> </ul><!-- #related-videos --> </div><!-- #sidebar -->I think this is the solution, but I don't exactly know how to use it. This code is from Stack Overflow.
<?php date('Y-m-d H:i:s', strtotime(sprintf('- %d second', round($speed * 60)))); ?>Here's a screenshot of what I'm working on. Check out the "Related Videos" on the bottom right.
Link to comment
https://www.neowin.net/forum/topic/1111301-convert-video-duration-number-to-time-with-php-or-jquery/Share on other sites
19 answers to this question
Recommended Posts