FC Software Blog

Email Marketing, CRM Solutions, Asset management, Campaign Tracking

MySQL Date format and PHP

This is just a very quick blog entry to provide a little snippet of code and hopefully help some people.

I offer coding help and advice on several PHP forms for beginners to the language.  One of the common problems they have seems to be date/time stamps and MySQL format and handling.  This seems to be especially relevant to UK coders where our dates take the format dd-mm-yyyy whereas MySQL stores the date in yyyy-mm-dd HH:mm:ss.

PHP is a wonderful language that makes working with dates etc actually very easy.  To resolve the format of date/times from MySQL to a more UK centric format I created a very simple function

function mysql2uk($date) {
      return date('d-m-Y H:i:s',strtotime($date));
} 
This brilliant little function in effectively a single line converts your mysql format date into a UK format date without you needing to wrap that entire line of code around every date you spit out.

So to use it your php page would simply be something like this

<?php
function mysql2uk($date) {
 return date('d-m-Y H:i:s',strtotime($date));
} 
$sql ="select * from table";
$result = mysql_query($sql) or die();
$values = mysql_fetch_row($result);
echo mysql2uk($values['column']);
?>

And as easy as that your date is now in a UK format.

You can edit the format by changing the 'd-m-Y H:i:s" part of the function and to save you having to have the function at the top of everyone of your pages you can put it in an include file and just include that file on your site/pages where you want the function available.

Hope this little snippet helps some.

August 11th, 2010 by admin

Small Basic Opensource Jobboard

A while ago a friend asked if I could knock together a very basic job board for him just to post 4-5 roles he was currently recruiting for.

Being the good friend I am I agreed and 10 minutes later he had his job board.

It recently came about that others may find such a thing useful as well.  To this end I’m posting the Job Board zip file to this blog. Feel free to download it and use it if you want.  There is no license attached to this so do with it what you will.

Word of warning though to those of you that may be expecting an all singing and dancing system – this isn’t it! this is very basic and very simple and served its purpose.  There is no support with these files.

opensource-basic-jobboard

Good Luck

Dave

February 3rd, 2010 by admin

Busy Busy

Its been a hetic few months at FC Software.

We’ve upgraded our Stockbroker B2C CRM platform to support trade tracking and commission based payroll for users.  Added more advanced reporting features and fixed a slew of bugs found in the system.

We’ve updated the E-Commerce Package EZ-Shop to version 1.0.1 which fixes a few bugs found since it went open source.  You can download the latest installer pack from the open source section of our website.

We’ve implemented cashback features into the BlueLightCard website a service open for all Emergency Service workers in the UK.

We’ve also began planning and preparation to increase our hosted platform capacity and are currently looking at the feasability of blade’s instead of our current separate rack servers.

All in its been a bit mad around here recently.  We hope normal service will resume soon and are currently looking at other tools we’ve created that would be suitable for the open source world.

November 24th, 2009 by admin

FC Software goes Opensource

Well I’ve alway been a big fan of opensource products, at FC we use many on a daily basis.  Finally we are in a situation to give a little back I hope.

Available immediately we have made our E-Commerce platform Opensource under the GPLv3 license.

I was going to write an epic blog post about it and our reasonings etc but I don’t think thats really required.

Instead go look at our opensource page and see for yourself. http://im.ly/6d089/

Download it play about with it, improve it, fix it ;) and get in touch we’d love to hear what your doing with the software.

Just remember if you decide to distribute it yourself to leave the link back to FC on the page’s!

September 18th, 2009 by admin