Hey Rich,
> > 1) read the files from a directory, discard the
> files
> > with a .php extention and the directories (eg: .
> and
> > .. )
> >
> > 2) put the files into an array ($the_files[])
> >
> > 3) put it into a while loop and display the files
> like
> > so:
>
> //Only do files over 2 hour
Here is what I have used for mktime..
$unix_date_33 = mktime(0,0,0,date("m"),date("d")-33,date("Y"));
I am getting the current month, day, and year from the system.
I am subtracting 33 days from the current day.
The result is compared to a date value from the database.
Jef
-Original Messag
On Thu, May 11, 2006 3:37 pm, Ryan A wrote:
> So far this is what I have done:
> -
> 1) read the files from a directory, discard the files
> with a .php extention and the directories (eg: . and
> .. )
>
> 2) put the files into an array ($the_files[])
>
> 3) put it into
Hey,
First, thank you Eric and Stut, your answers and this
article that I found on the web
http://www.phpbuilder.com/columns/akent2610.php3?print_mode=1
put my mind back on the right tracksometimes its
so damn silly how things you use for ages suddenly get
"muddled" up in the head.
Thank
On 5/11/06, Ryan A <[EMAIL PROTECTED]> wrote:
Hey,
So far this is what I have done:
-
1) read the files from a directory, discard the files
with a .php extention and the directories (eg: . and
.. )
2) put the files into an array ($the_files[])
3) put it into a whil
Ryan A wrote:
echo $the_files[$i] . date("F d Y H:i:s.",
filectime($directory_with_files.$the_files[$i]));
The next step is, I want to only echo the files that
are over x minutes (or x hours) old, ignore anything
below, I am using mktime() along with date() to format
it accordingly...but am unab
[snip]
hi, is mktime() actually faster than date() or any other date functions?
[/snip]
This sounds like the perfect opportunity for you to write a test and
return the results.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Mark Steudel wrote:
> Im a little confused on the number I should use for the month:
>
> Take the following:
>
> echo date('Ymd', mktime(0, 0, 0, 3, 0, date("Y")) );
>
> I expected it to output: 20060331
>
> But instead it outputs 20060228.
Correct.
You are asking it for the zeroth day of
On 13 September 2005 00:08, Dan Brow wrote:
> A little confused with mktime, I'm trying to get how many
> days are in a
> year.
>
> $year = "2006";
> $epoch = mktime(0, 0, 0, 1, 0, $year); // I have to have 1
You're asking for the 0th day of the first month here, which is (guess what!)
the last
snip
>
> I'd shorten it up even more:
>
> $daysinyear = 365 + date("L", strtotime("jan 1 " . $year));
> ?>
Thanks works perfect.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Tue, 2005-09-13 at 11:13 +1200, Jasper Bryant-Greene wrote:
> Dan Brow wrote:
> > A little confused with mktime, I'm trying to get how many days are in a
> > year.
>
> How about doing it differently. I'd tackle this problem like this:
>
> $year = '2005';
> $time = strtotime("1 January $year")
"Jasper Bryant-Greene" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dan Brow wrote:
> > A little confused with mktime, I'm trying to get how many days are in a
> > year.
>
> How about doing it differently. I'd tackle this problem like this:
>
> $year = '2005';
> $time = strtotime
Dan Brow wrote:
A little confused with mktime, I'm trying to get how many days are in a
year.
How about doing it differently. I'd tackle this problem like this:
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/
If you find my advice useful, please consider do
On 8/31/05, Hal 9001 Consulting <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I've got a problem with mktime. It's a very strange behaviour, I don't know
> if is a bug:
>
>
> echo date ("M-d-Y", mktime (0,0,0,07,07,2005)); -> Jul-07-2005 (right)
> echo date ("M-d-Y", mktime (0,0,0,08,07,2005)); -> Dec
You could do this like this ( as it is faster ):
function CreateDate($day, $month, $year) {
return $year.$month.$day.'00';
}
CreateDate(04,04,2004) -> 2004040400
But make sure you add the leading zero to $month and $day ( can
be easily done (number_format for example) )
-- red
Am
Guys, second thought.
mktime builds a unix time stamp (since the unix epoch, Jan 1, 1970 [I
guess]), the difference are maybe due to time zones, because its the
number of seconds since Jan,1 1970.
On Mon, 5 Apr 2004 06:29:12 -0400, Andy B wrote:
"On my personal machine the return value is:
1081
I got 1081047600 for
$time=mktime(0,0,0,4,4,2004);
echo $time;
(RH9, PHP 4.3.4)
On Mon, 5 Apr 2004 11:34:11 +0100, Nunners wrote:
I got 1081033200
Two thoughts:
1 - is $time a global variable predefined as the current time? Don't
think
it is?!?!?!
2 - Could it be to do with local time
Woops little mistake there, first of all it's 'gmmktime()' secondly the source
should look something like:
$var = mktime ( 0,0,1,4,4,2004 ) - 1;
You can find a nice article on this topic here:
http://www.phpbuilder.com/columns/ehresman20030911.php3?page=1
-- red
[...]
> Your Server will most
Your Server will most likely run in a different timezone. If both of you
would use gmktime() the result will be the same.
As for the negative result: Had the same problem some time ago - seams
to me as if PHP doesn't like those 0,0,0 ( try 0,0,1 instead ) - You can
adjust the result by reducing th
I got 1081033200
Two thoughts:
1 - is $time a global variable predefined as the current time? Don't think
it is?!?!?!
2 - Could it be to do with local time settings i.e. comparing american dates
with UK dates (1/Aug/04 and 8/1/04)?
Nunners
> -Original Message-
> From: Andy B [mail
--- Peter Torraca <[EMAIL PROTECTED]> wrote:
> print date ("m/d/y h:m:s A", mktime(16, 30, 0, 10, 10, 2003));
>
> gives the output: 10/10/03 04:10:00 AM
>
> Where did the 4:10 come from? It should be 4:*30*.
10 is the month, which is what the m means. Use i for minute:
http://www.php.net/date
> I parse the apache logfile and get a date format like this
> [03/Feb/2003:09:22:50 +0100]
> OK i split it with preg_match and the result is
>
> Array
> (
> [0] => 03
> [1] => Feb
> [2] => 2003
> [3] => 09
> [4] => 22
> [5] => 50
> )
>
> Now I'd like to convert it in a time
readon about strtotime() function
www.php.net/strtotime
you might not even need to preg_match() it
--
Maxim Maletsky
[EMAIL PROTECTED]
Torsten Rosenberger <[EMAIL PROTECTED]> wrote... :
> Hello
>
> I parse the apache logfile and get a date format like this
> [03/Feb/2003:09:22:50 +0
> -Original Message-
> From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> Sent: 02 January 2003 23:29
>
> The month behaves the same: both '08' and '09' are treated as zero by
> mktime().
A leading 0 on a number denotes it as octal. 08 and 09 are not valid octal
numbers. PHP is interpreti
Just to add to that... what it is doing is reading it as a 0.
0,0,0,09,30,1998 => 883458000
Tue, 30 Dec 1997 00:00:00 -0500
0,0,0,0,30,1998 => 883458000
Tue, 30 Dec 1997 00:00:00 -0500
Did you see this in the manual?
"The last day of any given month can be expressed as the 0 day of the next m
Well you are right.. I also get the same results...
I guess you found a bug... did you look in the bug reports to see if it already
exists?
Results
Thu, 2 Jan 2003 19:15:35 -0500
0,0,0,10,0,1998 => 907128000
0,0,0,10,00,1998 =
The month behaves the same: both '08' and '09' are treated as zero by
mktime().
Kirk
> -Original Message-
> From: Paul Roberts [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 02, 2003 4:24 PM
> To: Johnson, Kirk
> Cc: [EMAIL PROTECTED]
> Subject
same here win 2K apache php4.21
output
0,0,0,10,0,1998 => 90711
0,0,0,10,00,1998 => 90711
0,0,0,10,1,1998 => 907196400
0,0,0,10,01,1998 => 907196400
0,0,0,10,2,1998 => 907282800
0,0,0,10,02,1998 => 907282800
0,0,0,10,3,1998 => 907369200
0,0,0,10,03,1998 => 907369200
0,0,0,10,4,1998 => 907
Hi,
Friday, August 2, 2002, 10:52:14 PM, you wrote:
JB> Good morning!
JB> I need to subtract months by their abbreviated month name, so shouldn't this
JB> work?
JB> print(date("M", mktime(date("M")-$i));
JB> and if I loop;
JB> Aug
JB> Jul
JB> Jun
JB> May
JB>
Does this help...
$now
[snip]
I need to subtract months by their abbreviated month name, so shouldn't this
work?
print(date("M", mktime(date("M")-$i));
and if I loop;
Aug
Jul
Jun
May
[/snip]
Apparently not. But you can subtract by total hours in a given period, so
for an average I chose 30 days * 24 hours (
Hi Mike,
> > > Is there a magical function that I can use to convert 4
> > > into April and 5 into May etc?
> > > can I use mktime()
> > > One yes no answer will do fine
> >
> > Yes and no ;-)
>
> Ha! I was just about to say exactly that myself!
It was just too tempting :-)
> Except, to get
A couple of ways to do it:
strtotime('09 May 2002');
mktime(12,0,0,5,9,2002);
On Sat, 18 May 2002, Josh Edwards wrote:
> After reading the manual Istill can't convert this
> 09/May/2002 to a timestamp.
>
> Any Pointers
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsub
Hi Erik,
> On Wednesday, March 6, 2002, at 05:11 AM, DL Neil wrote:
>
> > My 'rules' are simple:
> > If the date/time is for processing, keep it as a timestamp (consider
> > which type).
> > If the timestamp is being used to keep track of RDBMS activity,
then
> > use a TIMESTAMP column.
>
> By
On Wednesday, March 6, 2002, at 05:11 AM, DL Neil wrote:
> My 'rules' are simple:
>
> If the date/time is for processing, keep it as a timestamp (consider
> which type).
> If the timestamp is being used to keep track of RDBMS activity, then
> use a TIMESTAMP column.
By RDBMS activity, do you
Erik,
Apologies, I missed your reply in the mass of mailings and a rushed
start to the week...
> > The choice comes down to how you are generating the time data prior
to
> > its storage in the db, and how you plan to use it afterwards. If you
are
> > going to be doing lots of temporal processing
On Monday, March 4, 2002, at 07:22 PM, DL Neil wrote:
> The choice comes down to how you are generating the time data prior to
> its storage in the db, and how you plan to use it afterwards. If you are
> going to be doing lots of temporal processing in PHP, then UNIX
> timestamp is the way to g
Erik,
> PHP's mktime() function uses a timestamp that is the number of seconds
> since the Unix epoch. MySQL uses the MMDDhhmmss format for its
> TIMESTAMP column type.
>
> I'm not complaining that they're not the same, but curious as to which
I
> should use for storing timestamps -- does it
Just make sure that whichever way you choose, you always use the same style,
so things don't get messy.
Personally, I always use INT(11) MySQL columns and store the unix timestamp
and this makes things easy for me. The only exception is when storing dates
that are before 1970, but I very rarely h
On Wed, 2002-02-06 at 11:28, David A Dickson wrote:
> I need to create a function in another programming language that takes the
> same input as the php mktime() function and produces the exact same output
> as the php mktime() function. Does anybody out there know what the
> algorithm is?
>
> --
0617600 1003852813~
--
Regards,
=dn
> Oh dear, I still get -3600 when I do
>
> echo gmmktime(0,0,0,1,1,1970);
>
> Why?
>
> James
>
> -Original Message-
> From: Fairbairn,J,James,IVLH4 C
> Sent: 23 October 2001 13:57
> To: [EMAIL PROTECTED]
> S
Oh dear, I still get -3600 when I do
echo gmmktime(0,0,0,1,1,1970);
Why?
James
-Original Message-
From: Fairbairn,J,James,IVLH4 C
Sent: 23 October 2001 13:57
To: [EMAIL PROTECTED]
Subject: RE: [PHP] mktime() problem
Thanks, I'll use gmmktime() from now on!
James
-Ori
Thanks, I'll use gmmktime() from now on!
James
-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: 23 October 2001 13:54
To: Fairbairn,J,James,IVLH4 C; php-general
Subject: Re: [PHP] mktime() problem
> I'm running 4.0.6 on a Solaris 8 box. The output gi
> I'm running 4.0.6 on a Solaris 8 box. The output given by
> echo mktime(0,0,0,1,1,1970);
> is 3600.
>
> Shouldn't it be 0? My box's locale is set to the UK defaults, so as I write
> this we are in daylight savings (GMT+1). Would this make a difference? (I
> have already tried
> echo mktime(0,0,
$time = time();
$timePlus4Days = $time + 60*60*24*4;
$tomorrow = date ("d", $timePlus4Days);
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-Original Message-
From: Christopher Allen [mailto:[EMAIL
On Mon, Feb 12, 2001 at 11:06:16PM -0600, Christopher Allen wrote:
> $tomorrow = date ("d", mktime(0,0,0,0,date("d") +4 ) );
> echo "Today + 4 days is $tomorrow ";
> screws up Feb et al
If you add the month and year, it should work just fine.
$tomorrow = date ("d", mktime(
use Date_Calc.
http://www.phpinsider.com/php/code/Date_Calc/
Diego Fulgueira wrote:
>
> I know the UNIX epoch is 1/1/1970 and that mktime() returns the number of
> seconds between that date and the date specified by its parameters. If this
> date is before 1/1/1970, it always returns -1, not a
46 matches
Mail list logo