logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Houseplants
Romance Movies
Creativity
Family Travel
Southwest USA
Irish Culture
Home Finance


dailyclick
All times in EST

Low Carb: 8:00 PM

Full Schedule
g
g PHP Site

BellaOnline's PHP Editor

g

The PHP Strtotime Function

Guest Author - Diane Cipollo

The PHP strtotime function is used to store a Unix timestamp as a value of a variable. But what makes this PHP function so versatile is the list of "human" keywords and abbreviations that you can use to create a specific timestamp to store in that variable. Let's take a look at the code and then the list of keywords and abbreviations.

$variable_name = strtotime("keyword or abbreviation");

<?php
$birthday = strtotime("June 6 2000");
?>

As you can see, the syntax for the strtotime function is straight forward. It begins with the variable name followed by an equal sign. Then inside the parenthesis and quotation marks is where the magic happens. You can use any of the keywords and abbreviations from the list below to create a timestamp for the variable. You can also use combinations of keywords and abbreviations. For the example above, the value stored in the $birthday variable will be my niece's birthday which is June 6, 2000.

Below is the list of keywords and abbreviations. Try replacing my example with various combinations from the list below.

Units of time such as
    year, month, week, day, hour, minute, second, am, pm, fortnight
English words for time such as
    ago, now, last, this, next, tomorrow, yesterday
Minus and Plus - and +
Numbers 1, 2, 3 . . .
Time Zones
    gmt, pdt, akst
Name of the months and abbreviations
Day of the week and abbreviations



This site needs an editor - click to learn more!

Add The+PHP+Strtotime+Function to Twitter Add The+PHP+Strtotime+Function to Facebook Add The+PHP+Strtotime+Function to MySpace Add The+PHP+Strtotime+Function to Del.icio.us Digg The+PHP+Strtotime+Function Add The+PHP+Strtotime+Function to Yahoo My Web Add The+PHP+Strtotime+Function to Google Bookmarks Add The+PHP+Strtotime+Function to Stumbleupon Add The+PHP+Strtotime+Function to Reddit




RSS | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the PHP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor