Solved

PHP strtotime   english phrase   for timestamp (date) desired

Posted on 2014-01-26
6
396 Views
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
0
Comment
Question by:willsherwood
  • 3
  • 3
6 Comments
 
LVL 83

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.
0
 

Author Comment

by:willsherwood
ID: 39811019
so you're suggesting my example isn't supported?
is there an alternate wording/syntax to achieve a similar result?
thanks!
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 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.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:willsherwood
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"

thanks
0
 

Author Comment

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

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now