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 usin
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
http://www.purewe
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
http://dev.mysql.com
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 date_format("%Y-%m-
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 dates
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 "$today === $few_days === $forward_date";
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 "$today === $few_days === $forward_date";
for($i=0;$i<$ndays;$i++)
{
$ne
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 include th
--- 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 times
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 tas
> -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 functio
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
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
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 t
- 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 d
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
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 i
Holmes" <[EMAIL PROTECTED]>
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 .
> 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
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 ti
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 returns
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 man
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"];
>
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]
> Su
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 additional
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) =
split("([
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,
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 Li
28 matches
Mail list logo