Articles of timestamp

Converting Unix timestamp to wordpress date

I have trouble converting Unix timestamp (i.e. 1473897600) to WordPress friendly date which displays at the date input field. I have a frontpage, post edit panel which is showing Unix timestamp. I guess this is the code for getting the post’s date; <?php $post_to_edit = array(); $post_to_edit = get_post($_POST[‘postid’]); $date = $_POST[ ‘_single_date’ ]; ?> […]

Change HTML Produced by wp_list_comments()

I am developing a WordPress theme for which I would like each comment’s timestamp wrapped in in a <span> element for the sake of styling it with CSS rules. However, the wp_list_comments() function as I use it in my theme’s comments.php template does not seem to provide options to alter the HTML produced: <ol class=”comment-list”> […]

Query by custom dates in UNIX Time

I actually have a custom date registered in UNIX Time in my database like this: meta_key : custom_date meta_value : 1322697600 and the type of the meta key is a longtext I would like to retrieve specific post according to the year of this custom_date I would like something like this : $args = array( […]

Date, Time, and Timezones

I am a bit confused about using dates/times along with timezones in WordPress. I have the following questions: What is the purpose of the timezone setting in the Admin -> Settings section? Assume current time in GMT is 20:00, and Assume I am in EST (so it is 16:00 in EST time), how is the […]

Finding difference in days

I want to store the current time using the update_option and then compare it if the set time was 3 days ago. I want to know in what format I should store the time? and then how can I compare it with current time and find the difference in the days?

Relative Time On Posts

I am looking for a way that I could add some code to my wordpress template to display the time of a post in relative terms. So if, for example, I posted something 5 minutes ago it would say something along the lines of Posted 6 minutes ago or 2 days ago, or 1 week […]

custom field value date convert to unix timestamp problems

For some reason, I’m having difficulty converting a date value stored in a meta field to a unix timestamp (and back again). If I save the date as a string it all works fine, but if I convert it to a timestamp using strtotime it won’t save the value. My working code looks like this: […]

Display date only once for a each set of posts relating to that date

The following loop works great for me in getting posts with a given date with the use of the_time(…): <?php $myPost = new WP_Query( array( ‘posts_per_page’ => ’50’, ‘orderby’ => ‘modified’, ‘order’ => ‘DESC’ )); while ($myPost->have_posts()): $myPost->the_post(); ?> <div class=”timeline-group”> <p class=”modified-time”><?php the_time(‘F j, Y’) ?></p> <h5><a href=”<?php the_permalink();?>”><?php the_title();?></a></h5> </div> <?php endwhile; //Reset […]

Why time functions show invalid time zone when using 'c' time format?

These are the functions I use in my theme to display the “entry-meta” which includes published and last modified dates (among others) of an article: // Shows Author and Published Date if ( ! function_exists( ‘reddle_posted_on’ ) ) : function reddle_posted_on() { printf( __( ‘<span class=”byline”>Posted by <span class=”author vcard”><a class=”url fn n” href=”%5$s” title=”%6$s” […]

Add 20yrs to post date, and then query

I would like to know if anyone knows a way of adding a timeframe (say 20 years) to the datestamp on a set of posts, and then running a query on the loop which uses the new date? Basically what I want to do is have a series of normal news posts. In addition to […]