distal-attribute
distal-attribute
distal-attribute
distal-attribute

convert VARCHAR to TIMESTAMP?

User, date Message
Written by westmatrix
6 years ago
Category: General
82 posts since Wed, 11 Apr 07
date = VARCHAR (30) current format 3 October 2008
How would I convert a VARCHAR to a TIMESTAMP along with the data.

Cheers
Written by rosenfield
6 years ago
127 posts since Wed, 24 Jan 07


select
unix_timestamp(
str_to_date(
'3 October 2008',
'%e %M %Y'
)
) as mytimestamp
;

Written by westmatrix
6 years ago
82 posts since Wed, 11 Apr 07
Wow that's neat, except it only works with the text entered and not the actual database field.
I asked without thinking.

table;
ID; DATE; NAME; PHOTO
data;
1, 3 October 2008, blah blah blah, Y

 

Please login to leave a reply, or register at first.