Date variable? - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-01-2005, 08:08 PM   #1 (permalink)
Junior Member
 
Join Date: Jul 2005
Posts: 24
Default Date variable?

Is there a php variable which holds the current date?
thejunior is offline   Reply With Quote
Sponsored Links
Old 12-02-2005, 10:51 AM   #2 (permalink)
Member
 
Join Date: Sep 2005
Posts: 219
Default

date?
[quote] print "`date '+%Y-%m-%d'";[quote]

Try that out
cristobal is offline   Reply With Quote
Old 12-03-2005, 04:38 AM   #3 (permalink)
Member
 
Join Date: Aug 2005
Posts: 401
Default

or you can try this

Quote:
<?php
// set the default timezone to use. Available since PHP 5.1
date_default_timezone_set('UTC');


// Prints something like: Monday
echo date("l");

// Prints something like: Monday 15th of August 2005 03:12:46 PM
echo date('l dS \of F Y h:i:s A');

// Prints: July 1, 2000 is on a Saturday
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));

/* use the constants in the format parameter */
// prints something like: Mon, 15 Aug 2005 15:12:46 UTC
echo date(date::RFC822);

// prints something like: 2000-07-01T00:00:00+0000
echo date(date::ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>
boohlick is offline   Reply With Quote
Old 12-03-2005, 08:52 PM   #4 (permalink)
Junior Member
 
Join Date: Jun 2005
Location: Finland
Posts: 26
Default

time() is a function holding the current unix timestamp, and date() is a function used to format that value.
clifford is offline   Reply With Quote
Old 09-03-2009, 04:13 PM   #5 (permalink)
Regular User
 
Join Date: Jun 2009
Posts: 49
Default Re: Date variable?

What uints does time funciton and date function return in?
gopalkr is offline   Reply With Quote
Old 02-07-2011, 06:09 AM   #6 (permalink)
Regular User
 
Join Date: Aug 2010
Location: India
Posts: 172
Default Re: Date variable?

DateTime is an extension, which you can use or not: it's not a part of the language. And the OP gave no indication that they were using DateTime... For a datetime object, it's best to use Datetime::add() and Datetime::sub().. Hope this helps..


Cheap used cars | Harley Davidson Motorcycles for sale | Medium Duty Trucks | Used cars for sale
Christina Lawrence is offline   Reply With Quote
Old 02-08-2011, 02:32 AM   #7 (permalink)
Junior Member
 
Join Date: Jan 2011
Posts: 20
Default Re: Date variable?

good post.
The Closer dvd
The Closer dvd box set

Last edited by lucas1986; 02-08-2011 at 02:38 AM.
lucas1986 is offline   Reply With Quote
Old 02-10-2011, 12:01 AM   #8 (permalink)
Junior Member
 
Join Date: Oct 2010
Posts: 85
Default Re: Date variable?

time() funnction will tell you the current date and time
almedajohnson is offline   Reply With Quote
Old 02-11-2011, 11:09 AM   #9 (permalink)
Junior Member
 
Join Date: Feb 2011
Posts: 37
Default Re: Date variable?

try this
<?php
echo date("Y/m/d");
?>
iphonesupport is offline   Reply With Quote
Old 02-11-2011, 08:59 PM   #10 (permalink)
Regular User
 
Join Date: Jan 2011
Location: Bangladesh
Posts: 626
Default Re: Date variable?

Variables in PHP

Variables are used for storing values, like text strings, numbers or arrays.

When a variable is declared, it can be used over and over again in your script.

All variables in PHP start with a $ sign symbol.

The correct way of declaring a variable in PHP:
$var_name = value;

New PHP programmers often forget the $ sign at the beginning of the variable. In that case it will not work.

Let's try creating a variable containing a string, and a variable containing a number:
<?php
$txt="Hello World!";
$x=16;
?>

You try to use this as example.

Last edited by mygold; 02-11-2011 at 09:01 PM.
mygold is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:42 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting