SQL PHP HTML ASP JavaScript articles and free scripts to download
 
 

PHP Date Today with time

PHP can generate today date and time in different formats for use in different applications. PHP date function returns date with a given format along with time. Here is a simple date command in PHP to display today date.
date("date format",[timestamp])

The output of the above command is: 05/17/08

Use of PHP timestamp in the date function is optional. To display the date in above format we have used the date format like this
date("m/d/y")

This will format the display to month / day / year format. We can change the display to any other format we want with use of different characters to format the string. You will get a list of such characters used for formating the date is listed at the end of this page.
Related Tutorial
PHP Date Format
PHP Time Stamp
Time Stamp Generator


Let us display the todays date with the present time using the date format characters in a better way.
May 17, 2008, 9:27 am

Refresh your browser window to see how the time is changing. Here is the code used to display the above date and time.
date("F j, Y, g:i a")

Discuss this tutorial at forum


Further readings
PHP Date Time
Validating Date: Checking if date exist
PHP Date Today
PHP yesterday and previous 7 days from today
PHP Date Format
Time stamp generator
Date selection drop down list box
mktime function to generate time stamp
Difference in Two dates by using mktime function
Finding month, weekday, day of the year etc for any date value
Breaking the date string to get month date and year using array













 

Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
PHP Tutorial Index
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
PHP Tutorials
Date & Time
Array
String Functions
Math Functions
Form Handling
File Handling
Comment Posting
Content Management
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.