|
|
PHP » Tips and Tutorials » Date and Time » Actual Time
A D V E R T I S E M E N T
Want free Oracle Magazine? Apply here now!
| Title |
Actual Time |
| Platform |
UNIX |
| Price |
Freeware |
| Author |
Visit Author Website |
| Website |
Visit Website of - Actual Time |
| Category |
PHP » Tips and Tutorials » Date and Time |
| Hits |
172 |
| Description |
/*
The Purpose of this function is to display the actual time in your time zone
if your web host has a different time from you.
In the function, the variable $timediff is the time difference in seconds
between your actual location and the location of your server or webhost.
If you are ahead of your server type in a positive integer such as 7200.
If you behind your server please enter a negative integer such as -7200.
In the first example you are 2 hours ahead of your server.
In the second example your are 2 hours behind your server.
Our Goal is to return a time like Saturday, August 15, 2004 08:55:05 PM EST.
*/
function actualtime () {
$timediff = -7200 ; // The time difference between your server and your time.
$timestamp = date('U'); // The timestamp at your server.
$timestamp = $timestamp + $timediff; // The calculated timestamp at your actual location.
$weekday = date('l', $timestamp); // Day of the week like Saturday.
$month = date('F', $timestamp); // Month of the year Like August.
$day = date('d', $timestamp); // Day of the month like 14
$year = date('Y', $timestamp); // A full numeric representation of a year, 4 digits like 2004
$hour = date('h', $timestamp); // The time in hours.
$minute = date('i', $timestamp); // The time in minutes.
$seconds = date('s', $timestamp); // The time in seconds.
$am_pm = date('A', $timestamp); // The Uppercase Ante meridiem and Post meridiem AM or PM.
$suffix = 'Eastern Time' ; // The suffix that you would like to attach at the end of your date and time.
$actualtimeis = "{$weekday}, {$month} {$day}, {$year} {$hour}:{$minute}:{$seconds} {$am_pm} {$suffix}" ;
return $actualtimeis ;
// function ends here.
}
echo actualtime (); // Prints something like Saturday, August 14, 2004 12:59:47 PM Eastern Time.
>
|
|
A D V E R T I S E M E N T
|
Subscribe to SourceCodesWorld - Techies Talk |
Scripts Related to - Actual Time
| Script Name |
This will calculate and show how many days there are from the current date to a date in the future that you define.
|
Given two dates, you can use this function to calculate the difference between them in terms of the number of years, months, weeks, hours, minutes and seconds.
|
A code snippet that displays today's date in the title bar of your web page.
|
Displaying the Current Date and Time. All data which may be obtained with command Date() is shown. A couple of examples are included: link of the day and local time
|
In this tutorial, you will be introduced to dealing with dates in PHP.
|
This technique is very helpful when you try to optimize your PHP script. Just add a few lines of PHP code and you will get a report showing execution time of your script in milliseconds.
|
PHP function to greet the user, according to the hour. Written in Spanish.
|
This tutorial describes how to write a simple script which looks at a list of events and only displays the events that occur today or in the future.
|
This is an example rich tutorial on adding a "last modified" date and time to your website. It includes full source code and description of its use.
|
This basic tutorial shows four different ways of displaying date and time using PHP functions on your Web page.
|
|
Google
Search
Source Codes World.com is a part of Vyom Network.
Vyom Network :
Free SMS, GRE, GMAT, MBA |
Online Exams |
Freshers Jobs |
Software Downloads |
Interview Questions |
Delhi Info |
Jobs, Discussions |
Placement Papers |
Free eBooks |
Free eBooks |
Free Business Info |
Interview Questions |
Free Tutorials |
Arabic, French, German |
IAS Preparation |
Jokes, Songs, Fun |
Free Classifieds |
Free Recipes |
Free Downloads |
Bangalore Info |
Tech Solutions |
Project Outsourcing, Web Hosting |
GATE Preparation |
MBA Preparation |
SAP Info |
Software Testing |
Google Logo Maker |
Freshers Jobs
Sitemap |
Privacy Policy
Copyright ©2003-2006 Vyom Technosoft Pvt. Ltd., All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/scripts/Actual-Time-19949/default.asp
Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions
| |