Dear All,
I was wondering if there are any major date function changes between php4 and
5.
When I say date function I mean mktime() , date() ,strtotime() etc.
Here is my dilemma, I've upgraded from php4 to php5. there is some very old
legacy code that is not working correctly.
Specifically
Paul Nowosielski wrote:
Dear All,
I was wondering if there are any major date function changes between php4 and
5.
I don't think so but check the docs:
http://www.php.net/manual/en/faq.migration5.php
When I say date function I mean mktime() , date() ,strtotime() etc.
Here is my dilemma,
:18 PM
To: Paul Nowosielski
Cc: php-general@lists.php.net
Subject: Re: [PHP] Date functions differences between php 4 and 5
Paul Nowosielski wrote:
Dear All,
I was wondering if there are any major date function
changes between php4 and
5.
I don't think so but check the docs
hi...
can anybody point me to a good/basic tutorial (tested) for php/mysql date
functions... basically, i want to store a date/time in a column, and be able
to read it, manipulate it, and update the table. i've seen various
articles/sample code, but i'm looking for something that i cna pretty
-Original Message-
From: bruce [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 11:12 AM
To: php-general@lists.php.net
Subject: [PHP] mysql/php date functions..
hi...
can anybody point me to a good/basic tutorial (tested) for
php/mysql date
functions... basically
Jim Moseby wrote:
Hi Bruce!
MySQL and PHP both have extensive built-in date functions that are clearly
documented and extraordinarily easy to use. For the vast majority of
situations, there is no need to manually write any custom date-handling
code. The decision to use MySQL or PHP to
-Original Message-
From: Silvio Porcellana [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 8:51 AM
To: php-general@lists.php.net
Subject: Re: [PHP] mysql/php date functions..
Jim Moseby wrote:
Hi Bruce!
MySQL and PHP both have extensive built-in date functions that are clearly
bruce wrote:
how can i create a mysql sql statement to insert a php 'time()' into mysql?
i've got the mysql var 't1, timestamp' but i can't figure out how to do an
insert
$q = time();
$sql = sprintf(insert into foo (id, ctime) values(%d, %???), $id, $q);
can't figure out how to get this to
), it doesn't work...
if i
-- insert into foo (id, time) values (2, NOW()), it works!!...
my question is why???
-bruce
-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 11:00 AM
To: php-general@lists.php.net
Subject: Re: [PHP] mysql/php date
, September 26, 2005 11:00 AM
To: php-general@lists.php.net
Subject: Re: [PHP] mysql/php date functions..
bruce wrote:
how can i create a mysql sql statement to insert a php 'time()' into
mysql?
i've got the mysql var 't1, timestamp' but i can't figure out how to do an
insert
$q = time
bruce mailto:[EMAIL PROTECTED]
on Monday, September 26, 2005 11:13 AM said:
i'm concerned that i can't seem to craft/create a basic sql cmd
within mysql to get a value (other than NOW()) to work...
[snip]
my question is why???
MySQL timestamps are different from UNIX timestamps.
Chris.
bruce wrote:
thanks...
but that's not it john... i'm not worried about creating the sql_statement
in the php...
i'm concerned that i can't seem to craft/create a basic sql cmd within mysql
to get a value (other than NOW()) to work...
if i do (from mysql)
-- insert into foo (id, time) values
but that still doesn't explain why i can't slam some value directly into the
timestamp var within the mysql tbl...
-Original Message-
From: Chris W. Parker [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 11:15 AM
To: php-general@lists.php.net
Subject: RE: [PHP] mysql/php date
john...
that appears to be it!! although i would have assumes it would have done a
most significant bit fill with 0's...
so my question also comes down to .. do i use the php date functions for
date/time manipulation.. or do i use the mysql functions
any thoughts/suggestions...
-bruce
bruce wrote:
john...
that appears to be it!! although i would have assumes it would have done a
most significant bit fill with 0's...
so my question also comes down to .. do i use the php date functions for
date/time manipulation.. or do i use the mysql functions
any thoughts/suggestions
-Original Message-
From: bruce [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 2:46 PM
To: 'John Nichel'; php-general@lists.php.net
Subject: RE: [PHP] mysql/php date functions..
john...
that appears to be it!! although i would have assumes it
would have done
Nichel [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 11:48 AM
To: php-general@lists.php.net
Subject: Re: [PHP] mysql/php date functions..
bruce wrote:
john...
that appears to be it!! although i would have assumes it would have done a
most significant bit fill with 0's...
so my
bruce
-Original Message-
From: bruce [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 12:38 PM
To: 'John Nichel'; php-general@lists.php.net
Subject: RE: [PHP] mysql/php date functions..
so you play with the time/date vars on the php side, and then simply store
them in the mysql tbl
bruce wrote:
or.. better yet.
if i do a php - time(), i get a unix_timestamp var. how do you guys store
this in mysql. you can't simply do an insert into a mysql/timestamp var. so
how do you convert it?
I don't convert it. I store the UNIX timestamp in an INT(11) column.
also, once you
John Nichel mailto:[EMAIL PROTECTED]
on Monday, September 26, 2005 12:43 PM said:
I don't convert it. I store the UNIX timestamp in an INT(11) column.
This is going to be a basic question I'm sure but why INT and not
VARCHAR? Is it simply because a timestamp is a number?
Chris.
--
PHP
- the php var?
thanks
bruce
-Original Message-
From: bruce [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 12:38 PM
To: 'John Nichel'; php-general@lists.php.net
Subject: RE: [PHP] mysql/php date functions..
so you play with the time/date vars on the php side, and then simply
Chris W. Parker wrote:
John Nichel mailto:[EMAIL PROTECTED]
on Monday, September 26, 2005 12:43 PM said:
I don't convert it. I store the UNIX timestamp in an INT(11) column.
This is going to be a basic question I'm sure but why INT and not
VARCHAR? Is it simply because a timestamp is
]
Sent: 26 September 2005 19:46
To: 'John Nichel'; php-general@lists.php.net
Subject: RE: [PHP] mysql/php date functions..
john...
that appears to be it!! although i would have assumes it would have done a
most significant bit fill with 0's...
so my question also comes down to .. do i use the php
Hello Bruce,
While the date functions are well documented - http://php.net/date - here is a
little example to manipulate the date with php, rather than mysql:
// set the new expiry date
// DATE FUNCTIONS FOR THE EXPIRY MODULE
// first perform date arithmetic
$listingExpiry = mktime
Hi,
You might already be fed up with my posts but I'm a complete PHP newbie and find these
groups are the best way to learn! Anyway I have the database date in the format:
-mm-dd hh:mm:ss e.g. 2004-02-24 07:57:59 but when in some situations I only want
to show the user the date in the
snip
You might already be fed up with my posts but I'm a complete PHP newbie
and find these groups are the best way to learn! Anyway I have the
database date in the format: -mm-dd hh:mm:ss e.g. 2004-02-24
07:57:59 but when in some situations I only want to show the user the
date in the format
Depending on your database engine (which you didn't mention in your
post), some allow you to format the date however you want it as you pull
it out of the database in your sql query. I always find this to be the
easiest way to do it. That way you don't have to worry about formatting
the data
On Tue, 2004-02-24 at 13:29, Matthew Oatham wrote:
You might already be fed up with my posts but I'm a complete PHP
newbie and find these groups are the best way to learn! Anyway I have
the database date in the format: -mm-dd hh:mm:ss e.g. 2004-02-24
07:57:59 but when in some situations I
i got 2 dates and i want to know how many minutes between em,, like:
$date1 = date(Y-m-j H:i);
$date2 = date(Y-m-j H:i, strtotime(now) + 1800);
$minutes = date_something($date1, $date2);
echo there are $minutes between, $date1 and $date2;
regards
patrick
--
PHP General Mailing List
Patrick
Off the top of my head... Convert both date1 and date2 to unix timestamps,
and subtract one from the other. That will give you the number of seconds
between them. Then, convert to hours, minutes, etc as required.
Peter
At 10:38 PM 9/23/2002 +0200, Patrick wrote:
i got 2 dates and
You should be working with UNIX timestamps here. Convert the dates to human
readble only after you've done the calcuations.
-Kevin
- Original Message -
From: Patrick [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 23, 2002 2:38 PM
Subject: [PHP] date functions
i got
Hi!
Say, has anybody re-written the date funtions so they work with any date and
not be crippled by the unix timestamp range limit?
I am looking for a function which will do the equivalent of
date(w,mktime(0,0,0,8,30,1934))
but that will actually *work*.
Does anybody know a way to return
Does anyone know a good way to count the days between two dates. ie how
many Mondays fall between two dates. As a starting point I have calculated
the start and end dates and the no of days b/w them.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
of. You will never live if you are looking for the meaning of life.
- Albert Camus
From: Josh Edwards [EMAIL PROTECTED]
Date: Sun, 19 May 2002 10:22:28 +1000
To: [EMAIL PROTECTED]
Subject: [PHP] date functions
Does anyone know a good way to count the days between two dates. ie how
many
Hi
I think this works :)
?
$date1 = 1/1/2002;
$date2 = date(m/d/Y);
$time1 = strtotime($date1);
$time2 = strtotime($date2);
//get the first monday after date1
$first_monday = strtotime(first monday,$time1);
//check if its within date2
if($first_monday $time2):
//set count to 0 as we
On Sun, 19 May 2002, Josh Edwards wrote:
Does anyone know a good way to count the days between two dates. ie how
many Mondays fall between two dates. As a starting point I have calculated
the start and end dates and the no of days b/w them.
Pretty much common sense, right? How about
I am using PHP 4, I have a date which I am adding to a MYSQL db, I have that
bit sorted, I am trying to calculate an 2 expiry dates, one that is 1 year
and 11 months ahead of the 1st date and another that is 2 years ahead of the
1st date.
Any Ideas, I have seen lots of scripts for adding days
On Mon, Aug 20, 2001 at 12:12:15PM +0100, Peter Allum wrote:
I am using PHP 4, I have a date which I am adding to a MYSQL db, I have that
bit sorted, I am trying to calculate an 2 expiry dates, one that is 1 year
and 11 months ahead of the 1st date and another that is 2 years ahead of the
1st
38 matches
Mail list logo