Hi
How about doing this in the query string you send to mysql:
DATE_FORMAT(fieldname, '%d %m %y')
this way you wont have to mess around with the array stuff. for more info look
here
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
Regards
Pure Web Solution
on the fly:
use date_format function in select statement, format should be a string
like %d%m%y not sure about it check on manual.
hth
adriano
2006/3/17, Tom Chubb [EMAIL PROTECTED]:
Please can you help me. I've created a page where problems are posted into
a
database and I am using the
If you are only avail with date-information then too you can use
existing DATETIME field as following query..
INSERT INTO `test` (`testingdate` ) VALUES ( '2006-06-06');
it will take care of itself.
Second way is you can change DATETIME field to VARCHAR (if you're not
going to use those
William Stokes wrote:
Hello,
I have a datetime column in MySQL DB. How can I match to that column from
php code if I only have the date information available.
2006-02-24 12:00:00 against2006-02-24
This might be more SQL question sorry about that.
Thanks
-Will
use
I have a datetime column in MySQL DB. How can I match to that column from
php code if I only have the date information available.
2006-02-24 12:00:00 against2006-02-24
This might be more SQL question sorry about that.
use date_format(%Y-%m-%d,'date_column') in the sql
Martin Cameron wrote:
$ndays=14;
function get_next_dates($ndays)
{
$today=date(m-d-Y,mktime(0,0,0,date(m),date(d),date(Y)));
$forward_date=date(m-d-Y,mktime(0,0,0,date(m),date(d)+$few_days,date(Y)));
print h1$today === $few_days === $forward_date/h1;
for($i=0;$i$ndays;$i++)
{
Beautiful,
many thanks
Ahbaid.
Martin Cameron wrote:
$ndays=14;
function get_next_dates($ndays)
{
$today=date(m-d-Y,mktime(0,0,0,date(m),date(d),date(Y)));
$forward_date=date(m-d-Y,mktime(0,0,0,date(m),date(d)+$few_days,date(Y)));
print h1$today === $few_days === $forward_date/h1;
quote
Hello all,
I would like to create a php function as follows:
function get_next_dates($ndays) {
/*
1. get the current date
2. create an array say $results
3. Store the dates for the next $ndays in $results
*/
return $results
}
So in my main program I can
--- Shaun [EMAIL PROTECTED] wrote:
is there a function in PHP that will work out the amount of time(hours)
beween two different dates / times?
You can just subtract the timestamps the find the number of seconds between any
two times. PHP has a rich set of functions to help you generate
of course ;)
but i couldn't find a reference to this particular problem...
Jay Blanchard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Have you checked the date functions at http://www.php.net ?
-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED]
Sent: Thursday, May
On Thu, 29 May 2003 15:40:00 +0100, Shaun wrote:
of course ;)
but i couldn't find a reference to this particular problem...
I don't think you are going to find a standard PHP function to do this.
You are going to have to do something like this (I haven't tried it
but I think it will do what
-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED]
Sent: 29 May 2003 15:40
of course ;)
but i couldn't find a reference to this particular problem...
Jay Blanchard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Have you checked the date functions at
On Thursday 29 May 2003 22:40, Shaun wrote:
of course ;)
Try:
$start_date_ts = time();
if ('Mon' != date('D', $start_date_ts)) {
$start_date_ts = strtotime(last monday);
}
$start_date= strftime(%Y-%m-%d, $start_date_ts);
echo $start_date;
Season to taste.
Have you checked the date functions at http://www.php.net ?
-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 6:39 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Date question
Hi,
For a given date, how can i find out the date of the day of the begining
of
- Original Message -
From: Charles Kline [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 2:17 PM
Subject: [PHP] date question
Hi all,
I have a form where users will be adding publication dates for uploaded
files. I want to store the date in mySQL as date('U')
On 05-Mar-2003 Sebastian wrote:
I have a date field in mysql in this format: Y-m-d H:i:s
I would like to echo Today if the date is today, can someone offer some
help? Thanks.
SELECT IF(TO_DAYS(datefld)=TO_DAYS(current_date),'Today',LEFT(datefld,10)) as
datefld, ...
Regards,
--
Don Read
I have used strtotime() function in the past, and done this:
if($time = strtotime('24 hours ago')) {
$new = new!;
}
with it being in UNIX time stamp .. But now I have a different client
where
the time stamp in mysql is formatted like:
2002-08-29 10:53:09
what function would I use in
]
To: 'Sebastian' [EMAIL PROTECTED]; 'php list'
[EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 12:40 AM
Subject: RE: [PHP] Date question
|
| SELECT column - INTERVAL 24 HOUR FROM your_table WHERE ...
|
| ---John W. Holmes...
- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: 'Sebastian
Hi,
Sunday, March 2, 2003, 3:39:37 PM, you wrote:
S Greetings all.
S I have used strtotime() function in the past, and done this:
if($time = strtotime('24 hours ago')) {
S $new = new!;
S }
S with it being in UNIX time stamp .. But now I have a different client where
S the time stamp in mysql
Not sure why you need the 5 days in advance bit, but this might give you the
tools to work it all out.
I prefer to work with dates in unix timestamp format (seconds).
To get now, use time()
To get next month, there's a kewl function called strtotime(), which
converts english phrases into
Hi Meltem,
The PHP manual is at http://www.php.net/manual/en (mirror sites as well).
-Original Message-
From: Meltem Demirkus [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 09, 2002 1:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP] date question
Hi,
Is there any function which
On Monday 20 May 2002 23:01, Randy Johnson wrote:
Is their a way to retrieve the previous month using/altering the code
below:
// get the current timestamp into an array
$timestamp = time();
$date_time_array = getdate($timestamp);
$month = $date_time_array[mon];
$day =
Hi,
If you want last month from the *CURRENT* date + time, then look at
something like strtotime('last month'), which may help, generating a time
stamp of the same day, time, etc in the previous month.
To format a different time stamp into what you want, consider the date()
function in the
If you put the date in MMDD format you can compare
the numbers.
http://www.php.net/manual/en/function.date.php
Jeff Oien
Hi,
Since there is no Date type in php, is there a way to compare dates?
Something like:
if ((3/8/2001) (3/9/2001)){
// Date is newer
}
Thanks,
Chris
You might try converting these dates to Unix time and then compare the
numbers as integers.
Let's see, here is a function that converts the data from a MySQL date field
to a Unix timestamp...
function mysql_to_epoch ($datestr)
{
list($year,$month,$day,$hour,$minute,$second) =
Ok, I understand that the epoch is a point in time that's static, but what
exactly is the epoch? I've heard it mentioned a lot on the list, but I have
no idea what it really is. :)
Jason
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
and
after 2^32 seconds after that.
Again, this specifics above may not be totally accurate, but are close
enough to describe the point.
John
-Original Message-
From: Jason Jacobs [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 08, 2001 12:22 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP
Which database?
Fang Li [[EMAIL PROTECTED]] wrote:
There is a LiveDate (-MM-DD) field in my table.
1. I want data from last 5 days up to now, and its order should be from
latest;
2. I want data for next month.
Any help would be appreciated.
--
PHP General Mailing List
28 matches
Mail list logo