Formatting Twitter’s Date/Time With PHP

Posted: August 18th, 2010 | Author: | Filed under: Tips/Tutorials
Tags: , , , , ,

This should save you a little googling. When you look at the XML that the Twitter API gives you, each tweet has a ‘created_at‘ timestamp.

It looks like this: Wed Aug 18 18:22:29 +0000 2010. Not too friendly, but it’s really simple to convert it to a unix timestamp, then format it with PHP’s date function.

Step 1: Make the unix timestamp with strtotime(). Now it’s turned into 1282155749, which is just what we need even though it looks worse.

Step 2: Format with date(). ‘l M j \- g:ia‘ turns it into ‘Wednesday Aug 18 – 12:22pm‘. You have total control of how it looks thanks to that date() function of PHP.

I pretty much dumped it all into a single line on one of the things I was working on. This is after I retrieved the XML into a variable called $xml.

echo date("l M j \- g:ia",strtotime($xml->status[0]->created_at));
Last Modified: August 18th, 2010
Share

3 Comments »

Disable WordPress’s Visual Editor On Specific Posts

Posted: July 11th, 2010 | Author: | Filed under: Tips/Tutorials
Tags: , , , ,

Simple and quick tip for WordPress. You might run into this if you have code snippets or other things in the HTML view that get malformed once you enter the visual view of the editor.

This WP plugin covers the basic functionality. The minor issue is that you have to open the post’s edit view to input the custom field, instead of having a button in the list of posts section of the admin area. Maybe there is a plugin for editing custom fields ajax-style, or a richer version of this visual/html toggle that I may have missed.

Last Modified: March 4th, 2011
Share

2 Comments »

VERY Powerful Batch Rename Application

Posted: May 18th, 2010 | Author: | Filed under: Software, Tips/Tutorials
Tags: , , , , , ,

Here’s a real time-saver. If you ever needed to rename or enumerate a bunch of files, and have been manually doing it up till now, then this is the program just for you. Ant Renamer is full of common actions you might have run into when dealing with larger amounts of files, such as photos of a vacation or frames of an animation.

You can add characters, search and replace strings, use the file date for its name, use EXIF information, or even run a regular expression on your file list. It displays what the output will look like at the bottom as a preview. Finally, there’s an Undo button if you make a mistake.

Check it out next time you have some heavy renaming to do. It’s freeware and even includes source code or translation files if you’re inclined to start modifying it.

Last Modified: March 30th, 2011
Share

No Comments »