[wp-hackers] Re: Sqlite

David House dmhouse at gmail.com
Fri Jun 24 19:14:07 GMT 2005


On 6/24/05, Jeff Minard <jeff at jrm.cc> wrote:
> So instead of:
> 
>         date($blog_date_format, $post_date)

Actually, instead of doing mysql2date($blog_date_format,
$post_date_gmt), you do date($blog_date_format, $post_date_gmt).
mysql2date() does a lot of string processing which is actually
relatively cheap, but if sqlite support is a plus side, I'd vote yes
for moving toward timestamp dates. I'm still for storing post_date and
post_date_gmt rather than post_date and post_timezone_offset, though;
it makes things simpler because you only have to add the offset once
(at INSERT time), rather than every time the page loads (SELECT time).

We'd have to recode mysql2date to recognise timestamps, but that's not
hard. In the spirit of talk less and code more, here's a diff:

@@ -17,10 +17,6 @@
 
 function mysql2date($dateformatstring, $mysqlstring, $translate = true) {
 	global $month, $weekday, $month_abbrev, $weekday_abbrev;
+	
+	if (is_numeric($mysqlstring))
+		return date($dateformatstring, $mysqlstring);
+	
 	$m = $mysqlstring;
 	if (empty($m)) {
 		return false;

-- 
-David House, dmhouse at gmail.com, http://xmouse.ithium.net


More information about the wp-hackers mailing list