Return time portion from datetime

4 posts / 0 new
Last post
talebi
Offline
Joined: 11/23/2021 - 14:15
Return time portion from datetime

Hi everyone,
 
I am wondering if there is a way to return the time portion from a datetime character value?
I tried @Ctot function but it returns "00:00:00".
I mean it should pull "01:28:31" from "12-Apr-2021 01:28:31". I am looking for a function not macros scripts.
 
Thanks,
 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

The problem is that you need to first isolate the time portion or the string, using the @Ctot will give you that result because it doesn't know where in the string the time portion is.  You can use the @Right to get that information.  Here is an example equation that should work.

@Ctot(@right(DATE_TIME, 8), "HH:MM:SS")

talebi
Offline
Joined: 11/23/2021 - 14:15

Thank you Brian, you are amazing

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Just been doing this for a long time Cool