Tuesday, January 26, 2010

Fun with SQL: Part 1

So about 2 years ago, the guy who built the CRM which I work on at work decided that storing dates in the format mm/dd/yyyy as a tinytext was appropriate for one of the tables. So today, after making a bunch of changes to the file that processes this data to format it correctly, I had to change the db data to match the new format. Thus, the magical str_to_date sql statement comes into play. Here it is for future reference:


UPDATE table
SET timestamp=str_to_date( `timestamp` , '%m/%d/%Y %h:%i:%s' )


This takes the current data (mm/dd/yyyy) and converts it to the proper data type for a DATETIME field (YYYY-MM-DD HH:MM:SS).

PS- No, I don't know why a field named "timestamp" was storing the date, and not the time. If I did, I'd likely throttle the former developer...

Wednesday, January 6, 2010

Welcome to the World of Tomorrow!

From TDWTF Sidebar:
El_Heffe:

The usage of floppy disks has declined tremendously over the years and people who are new to computers may have little or no experience with them. i never gave this any thought until recently when I was helping a co-worker with Microsoft Word.

I noticed that she always saved files by clicking on File --> Save. So I just casually mentioned "You know, there's another way to save files that I think is easier. Just click on the disk icon".

She stared at me blankly. So I pointed to the floppy disk icon. This was followed by a long pause and then she said "Oh ..... I thought that was a TV."


cconroy:

Fast-forward ten years or so: Co-worker, now senior level, is explaining to a new employee how to save more efficiently. New employee says, "What's a TV?"