Simple Date Math Manipulation Help Needed for Liquid

Jonny_Shaner
New Member
2 0 0

I want to output the date one day later than the date created and couldn't find how to do that in Liquid. I want the output in ISO 8601 format (yyyy-mm-dd). So this is what I have, is it close to being right?

{{ created_at plus : 1.days | date: "%F" }}

Replies 6 (6)
Jason
Shopify Expert
10505 178 2109

Try something more like this:

{{ product.created_at | date:'%s' | plus:86400 | date:"%F" }}

 

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.
Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.
★ http://freakdesign.com.au ★
Jonny_Shaner
New Member
2 0 0

Thanks Jason! That was exactly what I needed.

myrianne
Tourist
3 0 1

Hey thanks for this post!
I would like to know exactly the same thing but for getting the date of upcoming wednesday according to current date
I can't seem to understand the variables you're using  in this part : « date:'%s' | plus:86400 | date:"%F" »
The 86400 part seems to be the number of seconds in a day..

On my project, I cannot put a fix number because it depends of the current day of the week
So would there be a way to put the result of a js function in the output
I tried something like this but didnt work :
{{ nextWeekdayDate(); | date: "%a, %b %d, %y" }}

Greg_Saxton1
New Member
2 0 1

Removed Comment - I misread the original comment

myrianne
Tourist
3 0 1

SOLVED! .. on my own! thanks :)
it's actualy a case of (ifs and else ifs depending of the day of the week which can be found with modulo)

myrianne
Tourist
3 0 1
FOUND IT!! :)

thanks :D