Can someone help me format this column so tha...

Can someone help me format this column so that it displays the time format as HH:mm (1:30 PM)?

Iโ€™m using this formula in a virtual column

=CONCATENATE([City_17], ", ", [ETA])

โ€ฆso that I can have the City and ETA displayed in the same column. But when the time from the ETA shows up, it shows up as hh:mm:ss which is not desired. I have no idea how to achieve this, or

if itโ€™s even possible, so if anyone has any input, it would be greatly appreciated.

Thanks

0 24 485
24 REPLIES 24

Hi @Brady_Lovell Please set the time column {ETA} 's attribute โ€œIgnore secondsโ€ to true

Thanks @Suvrutt_Gurjar but the โ€œIgnore secondsโ€ option is already set to true, and I canโ€™t figure out why or what to do about it.

You can also use:

IFS(HOUR([ETA] - โ€œ00:00:00โ€) < 10),โ€œ0โ€),HOUR([ETA] - โ€œ00:00:00โ€) ,":",IFS(MINUTE([ETA] - โ€œ00:00:00โ€) < 10,โ€œ0โ€),MINUTE([ETA] - โ€œ00:00:00โ€)

This expression will generate the [ETA] as 04:00 for 4:00 AM

@Levent_KULACOGLU Youโ€™ve been a tremendous help, thank you very much!

@Brady_Lovell the below expression is a bit complex but will yield to result of H:mm AM/PM as you have requested. I have tested the expression and it works.

=CONCATENATE(

[City_17],

" | ",

IFS(

AND(HOUR([ETA] - โ€œ00:00:00โ€) >= 0, HOUR([ETA] - โ€œ00:00:00โ€) < 10 ), HOUR([ETA] - โ€œ00:00:00โ€),

AND(HOUR([ETA] - โ€œ00:00:00โ€) > 12, HOUR([ETA] - โ€œ00:00:00โ€) <=23), HOUR([ETA] - โ€œ00:00:00โ€) - 12

),

โ€œ:โ€,

IFS(

MINUTE([ETA] - โ€œ00:00:00โ€) < 10,โ€œ0โ€

),

MINUTE([ETA] - โ€œ00:00:00โ€),

IFS(

AND(

AND(HOUR([ETA] - โ€œ00:00:00โ€) >= 0, MINUTE([ETA] - โ€œ00:00:00โ€) > 0),

AND(HOUR([ETA] - โ€œ00:00:00โ€) <= 11, MINUTE([ETA] - โ€œ00:00:00โ€) <= 59)

)," AM",

OR(

AND(HOUR([ETA] - โ€œ00:00:00โ€) >= 12, MINUTE([ETA] - โ€œ00:00:00โ€) >=0),

AND(HOUR([ETA] - โ€œ00:00:00โ€) <= 23, MINUTE([ETA] - โ€œ00:00:00โ€) <= 59),

AND(HOUR([ETA] - โ€œ00:00:00โ€) = 0, MINUTE([ETA] - โ€œ00:00:00โ€) = 0)

)," PM"

) )

Iโ€™ve ran into a problem while testing this. Whenever the [ETA] column is empty, it displays a bunch of random numbers

@Brady_Lovell thatโ€™s normal. Because itโ€™s a TIME type column. In Java there is only DATETIME, not DATE and TIME seperately and when you refer to a time only, Java compiler considers it to be a Joda time which is Dec. 31st, 1899. When you leave the [ETA] column value blank, it considers it Dec. 31st, 1899 12:00:00AM I have added a ISNOTBLANK() control to my expression and it will work. If your [ETA] column is blank, it will appear as "City | - ", if itโ€™s not blank, it will appear as โ€œCity | 1:28 PMโ€.

=IFS(

ISBLANK([ETA]), CONCATENATE(

[City_17],

" | ",

" - "

),

ISNOTBLANK([ETA]), CONCATENATE(

[City_17],

" | ",

IFS(

AND(HOUR([ETA] - โ€œ00:00:00โ€) >= 0, HOUR([ETA] - โ€œ00:00:00โ€) < 10 ), HOUR([ETA] - โ€œ00:00:00โ€),

AND(HOUR([ETA] - โ€œ00:00:00โ€) > 12, HOUR([ETA] - โ€œ00:00:00โ€) <=23), HOUR([ETA] - โ€œ00:00:00โ€) - 12

),

โ€œ:โ€,

IFS(

MINUTE([ETA] - โ€œ00:00:00โ€) < 10,โ€œ0โ€

),

MINUTE([ETA] - โ€œ00:00:00โ€),

IFS(

AND(

AND(HOUR([ETA] - โ€œ00:00:00โ€) >= 0, MINUTE([ETA] - โ€œ00:00:00โ€) > 0),

AND(HOUR([ETA] - โ€œ00:00:00โ€) <= 11, MINUTE([ETA] - โ€œ00:00:00โ€) <= 59)

)," AM",

OR(

AND(HOUR([ETA] - โ€œ00:00:00โ€) >= 12, MINUTE([ETA] - โ€œ00:00:00โ€) >=0),

AND(HOUR([ETA] - โ€œ00:00:00โ€) <= 23, MINUTE([ETA] - โ€œ00:00:00โ€) <= 59),

AND(HOUR([ETA] - โ€œ00:00:00โ€) = 0, MINUTE([ETA] - โ€œ00:00:00โ€) = 0)

)," PM"

)

) )

@Levent_KULACOGLU Getting this error when I copy and paste your expression

"IFS function is used incorrectly:Inputs to IFS() must be one or more condition-value pairs. "

@Brady_Lovell do apologize for this inconvenience. It appears that I have forgotten a comma. I have edited my expression in the below post. Sorry for this.

Weโ€™ve almost got it!!!

@Brady_Lovell I will get back to you in an hour. Iโ€™m getting on bike and going home. I have to review the eval of my expression.

@Brady_Lovell Iโ€™ve wrapped up the expression a bit and here it is. I have tested it and it seems itโ€™s working properly.

=IFS(

ISBLANK([ETA]), CONCATENATE(

[City_17],

" | ",

" - "

),

ISNOTBLANK([ETA]), CONCATENATE(

[City_17],

" | ",

IFS(

AND(

AND(HOUR([ETA] - โ€œ00:00:00โ€) = 0, MINUTE([ETA] - โ€œ00:00:00โ€) >= 0),

AND(HOUR([ETA] - โ€œ00:00:00โ€) = 0, MINUTE([ETA] - โ€œ00:00:00โ€) <= 59)

),CONCATENATE(HOUR([ETA] - โ€œ00:00:00โ€) + 12,":",IFS(MINUTE([ETA] - โ€œ00:00:00โ€) < 10, โ€œ0โ€),MINUTE([ETA] - โ€œ00:00:00โ€)," AM"),

AND(

AND(HOUR([ETA] - โ€œ00:00:00โ€) >= 1, MINUTE([ETA] - โ€œ00:00:00โ€) >= 0),

OR(

AND(HOUR([ETA] - โ€œ00:00:00โ€) <= 11, MINUTE([ETA] - โ€œ00:00:00โ€) <= 59),

AND(HOUR([ETA] - โ€œ00:00:00โ€) = 12, MINUTE([ETA] - โ€œ00:00:00โ€) = 0)

)

),CONCATENATE(HOUR([ETA] - โ€œ00:00:00โ€),":",IFS(MINUTE([ETA] - โ€œ00:00:00โ€) < 10, โ€œ0โ€),MINUTE([ETA] - โ€œ00:00:00โ€)," AM"),

AND(

AND(HOUR([ETA] - โ€œ00:00:00โ€) = 12, MINUTE([ETA] - โ€œ00:00:00โ€) >= 0),

AND(HOUR([ETA] - โ€œ00:00:00โ€) = 12, MINUTE([ETA] - โ€œ00:00:00โ€) <= 59)

),CONCATENATE(HOUR([ETA] - โ€œ00:00:00โ€),":",IFS(MINUTE([ETA] - โ€œ00:00:00โ€) < 10, โ€œ0โ€),MINUTE([ETA] - โ€œ00:00:00โ€)," PM"),

AND(

AND(HOUR([ETA] - โ€œ00:00:00โ€) >= 13, MINUTE([ETA] - โ€œ00:00:00โ€) >= 0),

AND(HOUR([ETA] - โ€œ00:00:00โ€) <= 23, MINUTE([ETA] - โ€œ00:00:00โ€) <= 59)

),CONCATENATE(HOUR([ETA] - โ€œ00:00:00โ€) - 12,":",IFS(MINUTE([ETA] - โ€œ00:00:00โ€) < 10, โ€œ0โ€),MINUTE([ETA] - โ€œ00:00:00โ€)," PM"),

AND(HOUR([ETA] - โ€œ00:00:00โ€) = 0, MINUTE([ETA] - โ€œ00:00:00โ€) = 0),

CONCATENATE(HOUR([ETA] - โ€œ00:00:00โ€),":",IFS(MINUTE([ETA] - โ€œ00:00:00โ€) < 10, โ€œ0โ€),MINUTE([ETA] - โ€œ00:00:00โ€)," PM")

)

) )

@Brady_Lovell

In your expression, substitute just the [ETA] part with the expression below:

HOUR([ETA] - โ€œ00:00:00โ€) ,":", MINUTE([ETA] - โ€œ00:00:00โ€)

@Levent_KULACOGLU I donโ€™t know how to thank you enough. Nothing short of amazing that these kind of possibilities are available to us. Hopefully one day Iโ€™ll gain some of the knowledge that you have so Iโ€™ll be able to create complex expressions like this. Again, thank you!

Youโ€™re very welcome @Brady_Lovell, it was my pleasure to help. Good to know that your problem has been solved out. Appreciate your patience.

If your column is a virtual and all users are using the AM/PM format on their devices, you should be able to read the correct format with the TEXT expression. Then the formula would be like CONCATENATE([City_17]," | ",TEXT([ETA])

@Aleksi_Alkio you are a true Master really. Thanks for pointing out the difference and use of CONCATENATE and TEXT functions. And as Brady said to me, I can say the same to you: โ€œHopefully one day Iโ€™ll gain some of the knowledge that you haveโ€ฆโ€

@Levent_KULACOGLU This is what I just triedโ€ฆ

=CONCATENATE([City_17], " | โ€œ, HOUR([ETA]โ€œ00:00:00โ€),โ€:",MINUTE([ETA]โ€œ00:00:00โ€))

โ€ฆand I got the errorโ€ฆ

โ€œParameter 1 of function HOUR is of the wrong typeโ€

@Brady_Lovell sorry for that but minus sign interpreted as strikethrough text in my replyโ€ฆI have edited my post, so itโ€™s reflecting the correct syntax now

@Levent_KULACOGLU Just missing 1 digit for some reasonโ€ฆ

@Brady_Lovell do you wish to format that time as HH:mm or H:mm?

Just so that it shows up likeโ€ฆ

1:30 PM 12:30 PM 9:15 AM

@Brady_Lovell try this:

HOUR([ETA] - โ€œ00:00:00โ€) ,":",IFS(MINUTE([ETA] - โ€œ00:00:00โ€) < 10,โ€œ0โ€),MINUTE([ETA] - โ€œ00:00:00โ€)

This sure is a lot better than what we originally started out with. Any way to fine tune it to display like the 4:45 AM or 12:30 PM type format? If not, this is definitely doable.

Top Labels in this Space