Liquid Code in Standard Time instead of Military Time

I'm trying to edit our packing slip for Shopify so order.created_at no longer displays in military time and instead shows standard. Is there any way to code this? I know html would allow something like this: if (h = 13) {h = 1} if (h = 14) {h = 2} if (h = 15) {h = 3} if (h = 16) {h = 4} if (h = 17) {h = 5} if (h = 18) {h = 6} if (h = 19) {h = 7} if (h = 20) {h = 8} if (h = 21) {h = 9} if (h = 22) {h = 10} if (h = 23) {h = 11} if (h = 24) {h = 12} Is this plausible for it to return with am/pm instead of military? I don't even know what to try.

Comment (1)

Jese Leos

August 19, 2024

Verified user

You can convert the timestamp to whatever format you want using liquid filters {{ order.created_at | date: "%Y-%m-%d %I:%M:%S %P}}. This will convert your order.created_at to the specific format you're asking. You can understand more about it here in the documentation

You’ll be in good company