0

I have a column which has strings in the following format:-

2019-11-30T18:21:43.4775456Z

How do I convert it to timestamp? If I use the following I get NULLs

select cast(mycolumn as timestamp)

So obviously we need to specify format somewhere, but it appears that cast won't accept 'format' and also I am not sure which format to specify for the kind of values my column has.

The goal is to be able to perform max operation on this column as part of group by , but if I do that without any conversion , obviously it won't make sense as these are strings.

Dhiraj
  • 3,396
  • 4
  • 41
  • 80
  • surprisingly min and max are working accurately on this string format – Dhiraj Dec 04 '19 at 20:45
  • 1
    https://stackoverflow.com/a/23520257/2700344 Max and min, order and groupby will work fine w strings if they are in sortable comparable format like yours. – leftjoin Dec 05 '19 at 05:02

0 Answers0