Display time in 24 hour format

Hi,

Could someone please show me how to display the output of time-based formulas in 24hr time?

For example, I would like the output of my formula below to generate:

Wed, 1 Apr 2020 17:17:13 +1000

instead of:

Wed, 1 Apr 2020 5:17:13 PM +1000

Concatenate(Format("{1}, {2} {3} {4}",left(Today().WeekdayName(),3),Today().Day(),left(Today().MonthName(),3),Today().Year())," ",ToTime(Now())," +1000")

Any help would be greatly appreciated.

Hi!

No need for all those bulky Format()s — there’s a hidden FormatDateTime() formula that works just fine. The only downside is that the date and time formats are non-descriptive numbers, so some trial-and-error is required to find the right one.

Here’s the one that renders the first part of the date (without +1000):

Now().FormatDateTime(10, 3)

image
And you can just concatenate it to " +1000" then.

You can play around with the numbers (0 is don’t show the date or time part), you can separately render e.g. weekday from the date, then concatenate two desirable outputs together etc.

1 Like

Thanks Paul,

Excellent suggestion, thank you.

Do you have any suggestions on an efficient way to remove the commas I don’t need?

The format must be: Wed, Apr 1 2020 12:32:48 +1000

I can only get this to work with my bulky formula using Now().FormatDateTime(0, 3) to display the time in 24hr format.

Concatenate(Format("{1}, {2} {3} {4}",left(Today().WeekdayName(),3),Today().Day(),left(Today().MonthName(),3),Today().Year())," ",Now().FormatDateTime(0, 3)," +1000")

Result: Mon, 6 Apr 2020 13:32:32 +1000

If you need this for export (e.g. to insert in a spreadsheet that’s then processed by a parser that expects no commas), the solution I’d choose is to convert to text and delete the commas:

YourDate.FormatDateTime(10, 3).ToText().RegexReplace(",", "") + " +1000"

If you need to keep the comma after the day, you can tweak your regex to be e.g.
YourDate.FormatDateTime(10, 3).ToText().RegexReplace("(?<!^\w{3}),", "") + " +1000"

Means, replace all commas with empty string, except the one that comes right after string start and three word characters

Champion for sure.

I am actually creating a podcast RSS feed (XML file) and this is the field.

Brilliant solution, thanks.

Regards
Dean

For some reason I had to use Concatenate to get the +1000 to work.

Concatenate(Now().FormatDateTime(10, 3).ToText().RegexReplace("(?<!^\w{3}),", "")," +1000")