0

Formatting MSSQL (TSQL) Date Columns

by Jim Bouse 28. December 2012 08:18

I often need to format a date column from SQL into something nicer.  The code below does that.

CAST(DATEPART(m, DateCol) AS varchar(2)) +
'/' +
CAST(DATEPART(d, DateCol) AS varchar(2)) +
'/' +
CAST(DATEPART(year, DateCol) AS varchar(4)) +
' ' + 
CASE WHEN DATEPART(HH, DateCol) < 13 THEN RIGHT(REPLICATE('', 2) +
CAST(datepart(HH, DateCol) AS VARCHAR(2)), 2) ELSE RIGHT(REPLICATE('', 2) +
CAST(datepart(HH, dateadd(HH, - 12, DateCol)) AS VARCHAR(2)), 2) END + 
':' + 
RIGHT(REPLICATE('0', 2) + 
CAST(DATEPART(n, DateCol) AS VARCHAR(2)), 2) + 
':' + 
RIGHT(REPLICATE('0', 2) + CAST(DATEPART(ss, DateCol) AS VARCHAR(2)), 2) + 
' ' + 
CASE WHEN DATEPART(HH, DateCol) < 12 THEN 'AM' ELSE 'PM' END 
AS FormattedDate

Tags: , , ,

SQL

0

AirOS 5.5.2 for UniFi

by Jim Bouse 3. December 2012 13:41

From time to time, I install UniFi access points for customers.  These customers normally do not need a controller and just want a nice looking AP.  NVX from the UBNT forums put together the firmware needed to convert the UniFi to a standard UBNT radio.

Here is the original post: http://forum.ubnt.com/showpost.php?p=389380

I have mirrored the files here: AirOS 5.5.2 for UniFi.zip (10.65 mb)

Tags:

Ubiquiti | WISP

Powered by BlogEngine.NET 2.5.0.6
Original Design by Laptop Geek, Adapted by onesoft