Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


PHP strtotime   english phrase   for timestamp (date) desired

Posted on 2014-01-26
Medium Priority
Last Modified: 2014-01-26
i get year=1969 with the following function calls.
please help me correct what i'm doing wrong

      $ThisMonthStamp = strtotime("first day of this month");
      $ThisMonthYear  = date("Y", $ThisMonthStamp);
        echo $ThisMonthYear;

1969    <-- result displayed

this was executed today, 1/26/2014
Question by:willsherwood
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39811003
On the man page http://us1.php.net/manual/en/function.strtotime.php , there is a link in the parameters section for Date and Time Formats.  They kind of overstate what it will actually accept.

Author Comment

ID: 39811019
so you're suggesting my example isn't supported?
is there an alternate wording/syntax to achieve a similar result?
LVL 84

Accepted Solution

Dave Baldwin earned 2000 total points
ID: 39811022
Please read the pages I linked.  That's the 'official' words on the subject.

PS:  'this' doesn't mean anything to the function.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 39811036
i will re read again with a fine tooth comb to try to sort out your specific recommendation now that i understand you're specifically telling me about "THIS"


Author Comment

ID: 39811038
p.s.  i had similar results of 1969   with   next    and     last
so evidently not much works with that function
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39811040
It is very picky and I have rarely used it.  Thanks for the points.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question