/    Sign up×
Community /Pin to ProfileBookmark

strtotime – Two mondays ago??

Okay, is there any way to tell strtotime a particular day and the number of them ago? I was wondering if I could do it without first figuring out what today is. Strtotime(“Two Mondays ago”) does not work so I’m not sure if it’s possible. I need to start a report on Monday but, based on when a user may visit the page, it may be before the following Monday or after it when they visit the site so, simply saying strtotime(“Last Monday”) may simply find a day or two ago instead of 8 or 9 days ago.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@chazzyApr 12.2006 — is this based on data a database somewhere? where are you getting your dates from?
Copy linkTweet thisAlerts:
@ephmynusauthorApr 12.2006 — Today. But, based on when the page is visited, today might be Sunday or Tuesday, which messes up the whole Last Monday thing. I think I've just decided to go a different way though. Thanks anyhow.
Copy linkTweet thisAlerts:
@bokehApr 12.2006 — [code=php]$two_mondays_ago = strtotime("Last Monday - 1 week");[/code]
×

Success!

Help @ephmynus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...