iTech College - Internet Technology, Online Education, E-Learning, Technician Training, Tech Tutorials, Distance Education, Virtual Learning PHP Course: Date and Time - www.itechcollege.com PHP Course: Date and Time - www.itechcollege.com
Online Degrees Scholarships & Fellowships Internships Student Financial Aid Study Abroad Online Schools Itech Bookstore
Free Courses
HTML
JavaScript
CSS
ASP
PHP
JSP
C++
ASP.NET
SQL
AJAX
FTP
XML
Career Center
Job List
Job Search
Web Jobs
Student Jobs
Computer Jobs
Engineer Jobs
Developer Jobs
Resume Writing
Job Interview
Salary Info
Submit Articles
Online Training
for Your Job
Why I cannot find a job? Why nobody hires me?
Online degree for a Your Jobs. Online training, E-learning school, online certificate. PHP Course: Date and Time - www.itechcollege.com Earn your
online degree now!

courses > PHP > Date and Time

Date and Time

To display current date/time, use:

echo date('F d, Y H:i:s');

The result will be something like:

August 08, 2008, 14:06:39

To display a certain date or time formatted in a certain way, use mktime() and date(). It takes two arguments: the format that describes how to print the date and the time stamp that represents the date you want to print.

<?php
$dataEntry = mktime(18,15,0,1,10,2001);
$x = date('F d, Y - g:i a',$dataEntry);

echo "$x"
?>

will produce:

January 10, 2001--6:15 p.m.

To deal with times in Greenwich Mean Time (GMT), you can use gmdate() and gmmktime(). For example, for a machine in eastern daylight time, which is four hours behind GMT:

<?php
$today = mktime(12,0,0,6,6,2001);
echo 'Here it is '.date('g:i:s a, F d, Y',$today);
echo '';
echo 'In GMT it is '.gmdate('g:i:s a, F d, Y',$today);
?>

will produce:

Here it is 12:00:00 pm, June 6, 2001
In GMT it is 4:00:00 pm, June 6, 2001



  Back to Index Page
Next Page >>   Basic Tags
Statements Comments and Characters
echo
Variables
Array
Loop
The If Statement
Function
Send and get Query String
Date and Time
Cookies
Environment Variables
Use Database
Create Graphics
or_log
icon.ico
 
PHP Jobs
Student Jobs
Computer Jobs
New Jobs
PHP Books



Online Education, Online Training for Your Job, Distance Education, E-learning Programs for Your Career!Online Colleges, Online Universities, E-learning & Distance Education for Your Career! Easy Job Training & Online Courses.


   Email A Friend  
 
Earn Online Degree
for Your Job
I found a job after I earned an online degree!
Online classes for finding a Job. Online College, Online University, Degrees, E-learning school, online certificate Earn your
online degree now!
Online Training
for Good Job
Why I work so hard but earn so little? Why I cannot find a high paying job?
Online training for a Good Jobs. Online Degree, E-learning school, online certificate Go to
online school now!

Copyright ©2010, itechcollege.com. All rights reserved
iTechCollege | About iTech | Contact iTech