Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread cast a timestamp in a varchar field in different format to timestamp
Thu, Aug 22 2019 10:13 AMPermanent Link

Yusuf Zorlu

MicrotronX - Speditionssoftware vom Profi

We have a field, where the timestamp is in "dd.mm.yyyy hh:nn:ss", i.e. "18.08.2019 12:22:50".

is there a better way to convert this to a timestamp than that i use at the moment:

cast(substring(myvarcharfield,7,4)+'-'+substring(myvarcharfield,4,2)+'-'+substring(myvarcharfield,1,2)+' '+substring(myvarcharfield,12,8) as timestamp)
--
Yusuf Zorlu
MicrotronX
Thu, Aug 22 2019 10:16 AMPermanent Link

Yusuf Zorlu

MicrotronX - Speditionssoftware vom Profi

Wow, sorry, but now i have found a better way with cast i have not seen before:

cast(oestatustext2 as timestamp DATE FORMAT 'DD.MM.YYYY'),

So this seems to be the best way,
--
Yusuf Zorlu
MicrotronX
Image