Hi all,
(first time I send an email here, so please be forgiving if something
doesn't follow expected rules.)
My web application allows users to enter time stamps (date and time)
given as local times. The time stamp is to be stored as UTC into the
data base.
Since we have summer and winter
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
database.
Jef
-Original Message-
From: Ryan A [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 11, 2006 2:38 PM
To: php php
Subject: [PHP] Mktime formatting problems
Hey,
So far this is what I have done:
-
1) read the files from a directory, discard the files
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
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 while loop and display the files like
so:
echo $the
[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
hi, is mktime() actually faster than date() or any other date functions?
tnx.
--
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
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.
In the examples for january in the php manual I get december instead of
january.
Is
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
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 for month or
I get which day it is now. Which sucks.
$date = date("z Y", $epoch);
print($date); // here is the problem, I get 365 days, but the
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
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-07-2004 (?)
Can anyone help me to solve this question? Is it a bu
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
if you need to turn the result of mktime() into a valid mysql timestamp
format then put these 2 lines in your code when needed:
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
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
time settings i.e. comparing american
dates
with UK dates (1/Aug/04 and 8/1/04)?
Nunners
> -Original Message-
> From: Andy B [mailto:[EMAIL PROTECTED]
> Sent: 05 April 2004 11:29
> To: [EMAIL PROTECTED]
> Subject: [PHP] mktime error
>
> "On my perso
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
rom: Andy B [mailto:[EMAIL PROTECTED]
> Sent: 05 April 2004 11:29
> To: [EMAIL PROTECTED]
> Subject: [PHP] mktime error
>
> "On my personal machine the return value is:
>
> 1081026000"
> interesting... i got 1081054800 from mine with the code:
> $time=mktime(0,0,0
"On my personal machine the return value is:
1081026000"
interesting... i got 1081054800 from mine with the code:
even on cli it gives the same thing
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi there,
On a host running:
PHP 4.3.5 (cli) (built: Apr 3 2004 07:11:21)
I found a strange error produced by the mktime() function:
mktime(0, 0, 0, 4, 4, 2004)
returns -7262
On my personal machine the return value is:
1081026000
If anybody's aware of that bug and if it's fixed, please answe
--- 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'm taking a postgres timestamp from the database to something I can
parse with PHP (i.e., a unix timestamp. Thing is, the date function
isn't giving me the result I expect. Check this out:
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
> 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
Hello
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 timestamp
with
> -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
Hi,
Friday, January 3, 2003, 10:33:39 AM, you wrote:
MJP> Just to add to that... what it is doing is reading it as a 0.
0,0,0,09,30,1998 =>> 883458000
MJP> Tue, 30 Dec 1997 00:00:00 -0500
0,0,0,0,30,1998 =>> 883458000
MJP> Tue, 30 Dec 1997 00:00:00 -0500
MJP> Did you see this in the manual?
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
t; $tmp";
$tmp = mktime(0,0,0,10,07,1998);
echo "0,0,0,10,07,1998 => $tmp";
$tmp = mktime(0,0,0,10,8,1998);
echo "0,0,0,10,8,1998 => $tmp";
$tmp = mktime(0,0,0,10,08,1998);
echo "0,0,0,10,08,1998 => $tmp";
$tmp = mktime(0,0,0,10,9,1998);
echo "0,0,0,10,9,1998 =
OK, I am mktime() challenged. Can someone please explain these results to
me?
I have some test dates in October of 1998. For the days numbered 1-7,
mktime() does not care whether I have a leading zero on the day or not, I
get the same timestamp regardless, e.g., both a '7' and a '07' for the day
Hi there,
does anybody know, if the behaviour of mktime() on RedHat Linux > 7.2 is
fixed in one of the latest PHP versions?
Since RH 7.3 it is not possible anymore, to get a negative integer from
mktime(), that means you can't get a UNIX timestamp for a date before
1.1.1970I experienced this
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 (
Good morning!
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
Thanks!
Jay
What if the hokie pokie really is what it is all about
***
*
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
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 unsubscribe, visit: http://www.php.net/unsub.php
I use this on a Unix server to get yesterday's date if it's a
Saturday:
if ($day == '6') {
$today1 = date("Y:m:d", mktime(0,0,0,$month,$day-1,$year));
}
But on my Windows 2000 machine it thinks it's 1999:12:05.
How can I do this on Windows? Thanks.
Jeff Oien
--
PHP General Mailing List (http:/
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
; > support such activities.
>
> Thanks David, I think I'm going to avoid potential problems with
> TIMESTAMP columns' unique features by just storing a PHP mktime()
value
> into a VARCHAR(15) column (advice from someone on this list, I can't
> remember who). Whil
avoid potential problems with
TIMESTAMP columns' unique features by just storing a PHP mktime() value
into a VARCHAR(15) column (advice from someone on this list, I can't
remember who). While it will mostly be a label, and I could take a
shortcut, the advantage is that I can always ref
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
essage-
> From: Erik Price [mailto:[EMAIL PROTECTED]]
> Sent: 04 March 2002 22:12
> To: PHP (E-mail)
> Subject: [PHP] mktime() into TIMESTAMP ?
>
>
> PHP's mktime() function uses a timestamp that is the number of seconds
> since the Unix epoch. MySQL uses the MM
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 matter? PHP h
windows 2000 php and apache says unexpected error on lines like netx one
if ($iDiaIni==date("t",mktime(12,0,0,$iMes,$iDia,$iAnio)))
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
>
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?
--
David A Dickson
[EMAIL PROTECTED]
--
PHP General Mailing
How can I make sure the user enters a date in format
mm/dd/ and the date must be between the year 1600
and 2038.
The script below meets the criterion above, except
mktime() or strtotime() does not validate year 1600
dates. Any suggestions? Thanks
$dateparts = explode('/', $Date);
$month =
I'm trying to calculate elapsed time and I'm having trouble using mktime
with variables. Here's my code;
$reformat_stop = str_replace(":", ",", $x[stop]) . ",1,1,2002";
$stop=mktime($reformat_stop);
I don't know how to format the code for mktime to use a variable. I keep
getting -1 for $stop bu
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,
Hi All,
This is my first post to this list so forgive me if this has been covered a
million times before
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
Hello all,
About 2 months ago I upgrade my php to 4.0.4pl1 and since then my mktime
fucntion will not work
I am tring
and I expect to see
05:00
but i get
19:00
or
18:59
What happend?
Before the upgrade it worked fine.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-ma
lto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 2:06 PM
To: php
Subject: [PHP] mktime + 4 days
Hi!
How to get this to work for every month:
$tomorrow = date ("d", mktime(0,0,0,0,date("d") +4 ) );
echo "Today + 4 days is $tomorrow ";
screws
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(
Hi!
How to get this to work for every month:
$tomorrow = date ("d", mktime(0,0,0,0,date("d") +4 ) );
echo "Today + 4 days is $tomorrow ";
screws up Feb et al
Thanks,
Christopher C. M. Allen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMA
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
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 large negative number,
which would be more reasonable, i think.
The question is: How can I know
72 matches
Mail list logo