Kythin's Rants Kythin rants about all kinds of things, but mainly website development, SEO and PC Gaming.

21Feb/120

Track a link in Google Analytics then open it in a new window

This is a really quick post just so I have it saved somewhere. A simple function I wrote to track a link but also then open the link in a new window instead of the same one (even if you used a target=_blank)

Feel free to use it, change it, whatever!

tracktoblank.js

 

- K

Filed under: Code Snippets No Comments
19May/110

Get the first and last days of last month in PHP

Here's a really simple way to get the first and last dates of last month in PHP using strtotime. This'll also format the dates correctly to use in comparisons with MySQL 'TIMESTAMP' fields! Nifty eh?


$lastmonth = strtotime("last month");
$fromdate = date('Ym01 00:00:00',$lastmonth);
$todate = date('Ymt 23:59:59',$lastmonth);

echo($fromdate.' to '.$todate);

Filed under: Code Snippets No Comments