Technology
Back to Technology
MYSQL Script To Convert UK Date Into Epoch Time

By: Gordon Rankine
Published: 27 Apr 2014 14:22

This is a simple script that will convert a UK date that is stored as a Varchar or text into an Epoch Timestamp. For Example 27/04/2014 will be converted to 1398553200.


SELECT
UNIX_TIMESTAMP(CONCAT (substring(column_name,7,4), '-', substring(column_name,4,2), '-', substring(column_name,1,2)))
FROM tbl_name



Replace column_name with the name of your column that has the UK date format & replace tbl_name with the name of your table.

You can verify your results using this epoch converter

Disclaimer: This script is provided as is without any warranty. You are responsible for running this script and I will not be held accountable for any data loss or issues arising from this script.

Add Comment

SQL Queries   Scripts   MYSQL   Date Conversions   Epoch

Back to Technology