I was juts wondering exactly what this is...
Thanks,
~someonewhois
| SitePoint Sponsor |
I was juts wondering exactly what this is...
Thanks,
~someonewhois
- Nathan
It gives the number of seconds since the epoch. I'm not fully clued up on this, but it is some date in the past that UNIX dates are based on, or something like that
[edit]Here is some more info:
http://www.linuxplanet.com/linuxplanet/tutorials/215/1/
Sean![]()
Last edited by seanf; May 9, 2002 at 13:39.
Harry Potter
-- You lived inside my world so softly
-- Protected only by the kindness of your nature
/me thinks that was copied from the php manual!
I see...
I got this code from a friend for flood control, and it uses that date. If you take it from like 5 minutes ago, in a database, and you subtract if with the now ("U"), it'll give you 1 for soem reason.
I will chagne it to something mroe specific..
Thanks,
~someonewhois
- Nathan
a trick you could use is assign a variable at the top of the page...
Then you could just use the variables....just a time saving idea.PHP Code:$nowtime = now("U");
$phpdate = date("U");
Sketch
Errm...
I tried that...
Fatal error: Call to undefined function: now()![]()
- Nathan


Originally posted by Sketch
SketchPHP Code:$nowtime = now("U");
$phpdate = date("U");
/me thinks Sketch mistook MySQL for PHP <smile>
now() is a MySQL date-tag, and has nothing to do with PHP, per-sae.
is simply a method of acquiring the date/time stamp in UNIX format.PHP Code:date('U');
There are still a fair amount of programers who still use the UNIX-Format, for dates within their scripts.
Others use GMT, and others use the SQL method of xxxx-xx-xx xxx
x
Which one you use, AFAI'm concerned, is which one you like the best. Many, many, people will tell you 'xyz' is the best, but I've never seen anything to really prove one method is better than the other.
The only problem I've ever encountered using Unix-format, is that it doesn't handle dates 50+ years ago. So, if you are have a field where people enter their age, and you have a bunch of old'folk, the datestamp will not work correctly. I cannot comment on GMT method, never used it. The normal SQL method is really good if you are a SQL fan.
Anyway, these are just my own thoughts and opinions.
I see, thank you!
I kinda figured somethign liek that!
Thanks,
~someonewhois
- Nathan
BTW, date('U') is exactly the same as time(), no?![]()
- Matt
Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
"Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR
www.php.net/date has a list of all the letters used for time.
- the lid is off the maple syrup again!
is this in reply to me? i'm aware of all the letters used in date().Originally posted by notepad_coder
www.php.net/date has a list of all the letters used for time.i'm saying that date('U') is, according to the page you linked
this is exactly the same as time()'s output, is it not?U - seconds since the epochrun this
and they should both be the same, proving my point.PHP Code:echo date('U'), '<br />', time();
![]()
Bookmarks