Feeds:
Posts
Comments

I noticed that many people search for ‘this month’s date range’. The trick lies in knowing which month you want to go to and that mktime can automatically find the end of the month by passing 0 into the day field.

Well in no short order here it is:

// casting as date object, otherwise it returns a unix timestamp
$first_of_this_month = date('m/d/y',mktime(0,0,0,date('m'),1,date('y')));
$end_of_this_month = date('m/d/y',mktime(0,0,0,date('m')+1,0,date('y')));

// if run on 4/01/11
var_dump($first_of_this_month,$end_of_this_month);
// outputs
// string(8) "04/01/11"
// string(8) "04/30/11"

4D Linux ODBC Driver

Yea, there are OTHER operating systems out there other than Windows Server and Mac OS Server.

Just thought you should know 4D. Any version support (v11 or v12) would be great.

My official 4D feature request.

Took me forever to figure this out because the docs out there for 4D are minimal.

Easy configuration of multiple data sources is crucial if you want to use CodeIgniter or any other framework that allows configuration files to control the deployment and connection to various databases.

// get the connection resource
$connect = odbc_connect('DRIVER={4D v11 ODBC Driver};SSL=false;SERVER=192.168.1.100;PORT=19812;UID=user;PWD=password',"","");

I played with various different ways of doing this connection string, and found the above the most straight forward. You can leave password blank if there isn’t one.

Now if only they would make a linux odbc driver…

Design a site like this with WordPress.com
Get started