Last active
May 12, 2016 14:08
-
-
Save tessguefen/857e442dd7ea352f7ed031c60aa5876e to your computer and use it in GitHub Desktop.
Determine "Next" Tuesday (or any day of week i guess)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <mvt:comment> | |
| Logic to determine Next 'Tuesday' | |
| Tuesday is "3"" | |
| </mvt:comment> | |
| <mvt:assign name="l.dayofweek" value="3" /> | |
| <mvt:assign name="l.today_dow" value="time_t_dayofweek( s.dyn_time_t, g.Merchant_Local_Timezone )" /> | |
| <mvt:assign name="l.math" value="( ( l.today_dow - l.dayofweek ) - 7 ) * -1" /> | |
| <mvt:assign name="l.next_tuesday" value="mktime_t( s.tm_year, s.tm_mon, s.tm_mday, 0, 0, 0, g.Merchant_Local_Timezone ) + ( 60 * 60 * 24 * l.math )" /> | |
| <mvt:assign name="l.months" value="miva_array_deserialize( 'January,February,March,April,May,June,July,August,September,October,November,December' )" /> | |
| <mvt:assign name="l.month" value="l.months[ time_t_month( l.next_tuesday, g.Merchant_Local_Timezone ) ]" /> | |
| <mvt:assign name="l.day" value="time_t_dayofmonth( l.next_tuesday, g.Merchant_Local_Timezone )" /> | |
| <mvt:assign name="g.ships_on_date" value="'Tuesday, ' $ l.month $ ' ' $ l.day" /> | |
| &mvt:global:ships_on_date; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment