The date-time tag has no wiki summary.
9
votes
3answers
5k views
How to get WordPress Time Zone setting?
Can someone tell me how to get the time zone that is set in the WordPress Admin?
For example, if the blog is set to Eastern time, I need this exact string to print out:
US/Eastern
This is for a ...
7
votes
3answers
7k views
Order by meta value or date?
Got a custom field called startDate but its only on a few events. I was wondering if it isn't set for a post I could use post_date to generate the posts list?
// if meta_key _postmeta.startDate isn't ...
4
votes
4answers
969 views
order posts by date like craigslist
the image is worth a thousand words. take a look at it.
you know how craigslist has posts organized by date ..ex
Tue 3
post links for tuesday
Wed 4
post links for wed
Thurs 5
post links for ...
4
votes
3answers
4k views
Custom Post Type Archives by Date and Taxonomy
Lets use the classic example of a custom post type called "movies", with its own taxonomy called "genre".
By registering the custom post type (with a "movie" slug), the permalinks are already set up ...
4
votes
2answers
1k views
Default timezone hardcoded as UTC?
While debugging a plugin I was writing, I noticed that on line 36 of wp-settings.php, the default timezone is hardcoded to UTC with a call to the date_default_set_timezone() function. This means any ...
4
votes
1answer
1k views
Custom Post Type Archives by Date with Custom Permalink
I'm a bit stuck with getting the custom permalink for custom post type (CPT) archive to work.
I've registered my 'press_release' CPT as following:
add_action('init', 'press_release_post_type_init');
...
3
votes
2answers
5k views
Convert jQuery Datepicker Format to SQL Date Format
I set the jQuery Datepicker format to D d.m. displayed as Th 3.3. for a custom meta field that I want to use to sort posts. In SQL, the custom meta field is saved as D d.m.
I would like to display ...
3
votes
2answers
1k views
What's the difference between get_the_time and get_the_date?
Both function returns date and time. What's the difference between them? Do you have any example? Thanks.
3
votes
1answer
68 views
How to display date such “x ago”
I want display date based on how much time has passed since, i. e. Posted 12 minutes ago
3
votes
4answers
3k views
Sorting a query by custom field date
EDIT: Reworded the question for more clarity
I'm trying to sort by custom meta box data, which I am converting to a date using the strtotime function, but I'm having some difficulty.
My chief ...
3
votes
1answer
1k views
Display last login time
I am using this script to get the last time a user logged in
function get_last_login($user_id) {
$last_login = get_user_meta($user_id, 'last_login', true);
echo human_time_diff($last_login) . ...
3
votes
3answers
635 views
Set Custom Post Type title to the Post's Date
I have a custom post type, called 'status' and I have disabled 'title' in the post type. Right now it's setting all posts to have the title "Auto Draft". I want to set up a way to set the title to be ...
3
votes
2answers
62 views
What is the best workaround for supporting all existing DATEs?
I want to make a weblog that has with every date 1 or more weblog posts, e.g.:
Januari 24 Year 41 : Roman Emperor Caligula was murdered by Cassius Chaerea and the disgruntled Praetorian Guards. ...
3
votes
1answer
270 views
Is it safe to use 'date_default_timezone_set' in plugin file?
I am using a sitemaps plugin which in very complex ways sets the timezone of <lastmod> (i.e. last modified time) for posts to GMT.
Temporarily, until the plugin developer fixes it, I need to ...
3
votes
1answer
400 views
Custom Post Type Archives by Date (stored as meta value) WP3.1
I would like to implement date-based archive functionality (similar to original WP Archives widget functionality) for custom post type (CPT). What makes it difficult is the fact that I need to group ...
3
votes
2answers
110 views
Running WP Cron on specific local time
The scenario is to run insert_post function every midnight (00:00) of local time. Must run daily on weekday.
function add_daily_task(){
if((date('l', time()) != 'Saturday') || (date('l', time()) ...
2
votes
2answers
46 views
Get date of last update outside of loop
I'm trying to figure out how to display the date that a post was last updated outside of the loop. I'm able to display the published date using get_the_time() but there doesn't seem to be a "loopless" ...
2
votes
1answer
837 views
How to Delete Old Comments by Date?
I run a contest/giveaway blog at www.mommylivingthelifeofriley.com and currently have over 160,000 comments on 1100 posts. I would like to find a way to delete all comments from my site which are ...
2
votes
1answer
1k views
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 ...
2
votes
2answers
2k views
Query between two meta values?
How do I limit the query by two custom meta fields, a start date and an end date? This is what my data looks like:
meta_key | meta_value |
------------------------|
start_date | 20100131 | //Jan ...
2
votes
1answer
187 views
Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
QUESTION
This is following a previous question that was graciously answered by Milo earlier here - How to sort CPT by custom meta value (date), and return posts month by month
In short, I'm having ...
2
votes
1answer
701 views
How to filter a dd/mm/yyyy date from a custom field in a query
I'm trying to build a query in order to sort some posts by a date custom field, where the dates are formatted dd/mm/yyyy.
It works by querying the database directly with get_results like in this ...
2
votes
1answer
163 views
How do I create a dynamically-updated copyright statement?
I'd like to find an optimized, WP_Query-safe method for generating a dynamically-populated copyright statement for the bottom of my themes. That is to say, I'd like to check the date (by year) of my ...
2
votes
2answers
624 views
Using date stored as custom field to filter posts displayed in admin
This seems like a fairly common problem, but I'm posting this as I've yet to find a solution to my problem here on WP Answers - any help is HUGELY appreciated!
Ok - so I have a custom post type of ...
2
votes
1answer
1k views
Plugin for changing a post's category based on it's post date?
Is there a plugin for Wordpress that will change a post's category based on how long that post has existed?
I have seen other Wordpress plugins that use a library called "simple pie" to manage a ...
2
votes
1answer
92 views
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 ...
2
votes
1answer
1k views
Custom post admin filtering by post meta (the date)
I've created a custom post type for events that uses a custom field to retrieve the date for the event. It works ok and I'm able to filter the displayed results using meta_compare to compare the date ...
2
votes
1answer
712 views
How to insert current date/time in the content of a post?
I'm making a list of suggestion here. I need to insert current date/time for each of my suggestions - they are added accumulatively.
If you have any idea on doing that, please share.
2
votes
1answer
182 views
How to List Events by Year and Month Using Advanced Custom Fields?
I have a custom post type "Kalender_item" with a custom Date Field (YYMMDD). I want to list all the posts on a page sorted by Year and Month.
For example:
November 2012 (all events that occure ...
1
vote
2answers
64 views
Echo Messages By Checking current_time()
Before asking for help I would like to clarify that I don't have advanced skills on PHP. What I want to achieve is to display different messages for every period of time that I set (I need this to ...
1
vote
2answers
134 views
How do you format the date as a two digit year? (ex. “10.12.10” instead of “10.12.2010”)
I did a pretty thorough search and found a couple of closed (and unanswered) topics on the WP forums. Does anyone know if this is possible? The codex doesn't specify this as an option.
Thanks!
1
vote
3answers
925 views
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 ( ! ...
1
vote
1answer
207 views
Why does this echo values in the wrong order?
I'm sure there is a simple reason/answer for this: Why does
echo 'Archive for '. the_time('Y');
give me 2010Archive for? I had expected it would give me
Archive for 2010
1
vote
4answers
759 views
wrong php date()?
hey guys,
it's weird and I've never experienced that before. I've created a new blog and a custom theme. I'm using <?php echo date("H:i"); ?>in my theme.
The time that's put is 2h earlier. ...
1
vote
1answer
1k views
Last time a user logged in
I'm building a site where users log in to view content specific to them. I would like to display the last date and time they logged in. How would I get this information from wordpress? If it ...
1
vote
1answer
636 views
Displaying year, month and day archives differently
I'd like to display daily archives differently than monthly/yearly archives. How do I check to see if the archive template is being pulled for a daily archive vs. a monthly/yearly archive?
1
vote
1answer
874 views
Whats the way to format a date after using get_posts()
I see that theres no way to get a formatted date from a function like
echo get_the_date($post->ID, 'd M Y');
get_the_date only works with the current $post. If I used get_posts() how can I ...
1
vote
1answer
21 views
“is_new_day()” alternative for years?
I don't believe there's a is_new_year() function in WordPress, as an alternative for is_new_day(). I'm trying to display the year only once for each set of posts, what would be the best way to do ...
1
vote
1answer
81 views
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 ...
1
vote
1answer
148 views
Change the 'published on' text?
I am using the date and time in the post dialogue to log the date and time of future events, and would like to change the text to reflect that.
Is there an action hook I can tap into to achieve that?
...
1
vote
2answers
91 views
Categorising posts/pages into years published
I have a lot of posts/pages, and I would like to create a list in my sidebar, showing all of the years that I have created posts/pages in, so for instance, if I have 5 posts/pages that were spaced out ...
1
vote
1answer
108 views
Converting timestamps to local time with date_l18n()
I've got a WordPress cron job that sends an email periodically and saves the timestamp when it was sent as an option, and I'd like to display a date on a settings page. Something like, "The last ...
1
vote
2answers
40 views
Changing “submitted on date” of comments
How do I change the "submitted on date" of a comment to an earlier date? I want to change the date that is displayed to the readers. As far as I know, I can change the date of the post by clicking the ...
1
vote
1answer
91 views
Show 1 post and after a specific date show the next one
I used the following query to have only 1 post published on the homepage from a particular category:
<?php if ( have_posts() ) : ?>
<?php ...
1
vote
1answer
98 views
Timezone UTC to PST
we are trying to figure out what's happening with our site's timezone. On general settings it shows that local time is correct while showing the UTC time next to it. The locale we have it as Los ...
1
vote
2answers
265 views
Display future posts?
Is there a way to display posts, scheduled for the future?
I want to use the published data as an event date and time, which is obviously in the future. I still would like to use these posts for a ...
1
vote
1answer
376 views
Wordpress Locale Switching on Accept-Language Header
Is there anyway to get wordpress to automatically switch locales based on the HTTP Accept-Language header?
Similar to how ASP.NET can do it with their globalization="auto" config setting. The reason ...
1
vote
1answer
657 views
SQL query to delete comments older than 90 days?
I'm working on a site that has 150,000 comments with an obvious hit in performance; is there an SQL query that can delete all comments older than say 90 days? They're not spam comments, and they are ...
1
vote
1answer
1k views
How would I bulk change posting date?
How would I bulk change posting date? I want to change about 20 post publish dates at a time in one click
1
vote
3answers
535 views
How do I set up my blog home page to show only this weeke's posts automatically?
on my WPWeekly.net website, I am currently having to set the number of posts to show manually in the Setup->Reading.
Is there a snippet that will let me have the home page blog show only the current ...
