Entries tagged "dates"

Add Delay Feature to Newsfeed

The newsfeed feature I developed a few years back works as expected. At times, however, I wish it would let me have a post automatically appear after a specific time. Especially now that I'm used to services like HootSuite that allow me to schedule tweets and other social media postings. [Continue reading]

Use MySQL’s Date Functions Instead of PHP’s

Many of the MySQL queries that I create include a date and / or time. My usual place to get this information was from PHP's date() function. At least until I discovered that MySQL has many built-in functions to do the same thing. Let's look at a quick example. [Continue reading]

Quickly Enter Today’s Date in phpMyAdmin

With the date-field types, phpMyAdmin provides a pop-up calendar for quickly selecting a time frame. However, I commonly create new entries by editing an old row and choosing the "Insert as new row" option. Using older entries causes the calendar to show dates based on the original entry. Since phpMyAdmin doesn't have an option for jumping to today's date, I end up clicking through the calendar options or typing the date manually. Well there's another, sometimes faster, way. [Continue reading]

Formatting Dates within the MySQL Query

Before displaying dates from a MySQL database, do you change the format? If so, how are you formatting those dates? For me, I typically went straight to PHP for the answer. That is until it was brought to my attention that MySQL has a built in function for formatting dates. Let's talk about the date_format() function. [Continue reading]

Sorting Two MySQL Table Columns as One

How do you sort database entries chronologically when there are two different date fields? One shows when the entry was updated. The other indicates when it was created. If the developer didn't have the hindsight to set both fields to the same date when an entry is created, how do you work with the fields for sorting? [Continue reading]

Using the Date Format Chosen by the User Instead of Hard-Coding Your Own in the WordPress Theme

WordPress has a setting under the admin panel where blog owners can indicate how dates should be displayed for blog posts and comments made to the blog. The setting isn't very useful though when the date format is hard coded into the theme. Instead of making users edit the theme files, let's take advantage of the WordPress setting. [Continue reading]

Choosing the Date Format in WordPress Themes: Let’s Give Control Back to the User

So many WordPress themes have the date format hard coded into the theme files. The problem is that some users will prefer to display the date in another way. Maybe the chosen format doesn't match their organization's style guidelines or maybe the format isn't grammatically correct. Changing a hard-coded date requires users to dig through file after file to modify every instance. Plus, if the theme developer releases an update, the user may need to do it all over again. To save users the hassle, why not let them decide how the dates are displayed. There is a setting in WordPress after all. [Continue reading]

You Haven’t Even Started Blogging and You Already Have a Typo

There are a number of blogs out there which list dates incorrectly. It doesn't help that many of the templates built for popular blogging platforms like WordPress, display the dates incorrectly be default. If you maintain a blog, develop templates, or have ever typed out the date; please stop writing them as October 3rd, 2011. [Continue reading]

Remember, It’s 2011: Tips for Remembering the New Year

It's that time of year again. The time when people vow to change some aspect of their life. Maybe they want to get in shape, stop smoking, get out of debt, etc. Well here is my suggestion for a New Year's resolution. [Continue reading]

Don’t Forget the Details

I recently heard an advertisement which said "Midnight movies are back starting this Friday with Indiana Jones and the Raiders of the Lost Ark." When I visited the theatre's website for the complete list of movies, I found out that Indiana Jones was shown a few weeks earlier. But there was some doubt in my mind since the website didn't list the year (see Figure 1); maybe I was looking at old information. However my confusion was cleared up when I heard the exact same advertisement over the next few weeks. [Continue reading]