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
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")
)
) )
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.
User | Count |
---|---|
40 | |
36 | |
32 | |
23 | |
16 |