Talking with PHP

Talking with PHP

Talking with PHP

I need the current time then I call the php function – time() and get the current Unix timestamp. Then function time() returns the second measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). Say for, in my website users can register for free for one year. I need to calculate an account expiration time after one year. How can I calculate the expiration time. I need to add one year with the account creation time. We may get the the date and time of account expiration using following code.

$expiration = date( 'Y-m-d H:i:s', time() + (365 * 24 * 60 * 60) );

I have another easy solution. See bellow.

$expiration = date('Y-m-d H:i:s', strtotime( 'now + 1 year' ) );

Everyone knows PHP is a flexible language. In the second statement, it seems I am talking with php. ha ha ha

Share and Enjoy:
  • Facebook
  • Twitter
  • Google Bookmarks
  • Digg
  • del.icio.us
  • MySpace
  • LinkedIn
  • Live
  • Ping.fm
  • YahooMyWeb
  • Posterous
  • Sphinn
  • Mixx
  • DZone
  • email
  • Furl
  • StumbleUpon
  • Technorati
  • TwitThis
  • Webnews.de
  • Yahoo! Buzz
  • blogmarks
  • Yahoo! Bookmarks
Posted in PHP. 3 Comments »

3 Responses to “Talking with PHP”

  1. Milon Says:

    Nice share…….

  2. Mohammad Sajjad Hossain Says:

    Whenever I forget this, I browse your site and re-memorize.

    Thank you for sharing this.

  3. online Says:

    perlu memeriksa:)

Leave a Reply