Re: [PHP] problem with mktime

2006-04-30 Thread Richard Lynch
On Sun, April 30, 2006 6:38 am, Ross wrote:
> I am using this to compare todays date with dates retieved from a
> database.
> The problem is it seem to retrun the same value for the $then variable
>
> and can be seen ot working here
>
> http://nationalservicesscotland.com/cms/time.php
>
>
> 
> session_start();
> include ('../shared/connect.php');
>
> $query= "SELECT headline, id, expiry, link FROM events";

Instead of fighting with mktime and using PHP logic to discard data
you pull through the narrow pipe from MySQL to PHP, why not just
construct your query to return what you want?

SELECT substring(headline, 1, 80), length(substring(headline, 80, 1))
as ellipsis, id, link FROM events where expiry >= now()";

You can use $row['ellipsis'] to decide to print "..." or not for the
headline itself.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with mktime, need to add 30 days to current date

2003-08-20 Thread Marek Kilimajer
$endDate=date('Y-m-d',strtotime("+30 day"));

James Johnson wrote:

Sorry about the previous post. 

Hi,

I need to make a date that is 30 days from the current date, and, am
having problems with mktime
Here's what I've tried:

$endDate=date('Y-m-d',mktime(0,0,0,date('m',time()),30,date('y',time()))
);
Return this: 2003-08-30

Is there an easy way to do this?

Thanks,
James



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Problem with mktime, need to add 30 days to current date

2003-08-19 Thread Sn!per
print date('Y-m-d',mktime(0,0,0,date('m'),date('d')+30,date('Y')));

Quoting James Johnson <[EMAIL PROTECTED]>:

> Sorry about the previous post. 
> 
> Hi,
> 
> I need to make a date that is 30 days from the current date, and, am
> having problems with mktime
> 
> Here's what I've tried:
> 
> $endDate=date('Y-m-d',mktime(0,0,0,date('m',time()),30,date('y',time()))
> );
> 
> Return this: 2003-08-30
> 
> Is there an easy way to do this?
> 
> Thanks,
> James
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 





---
Sign Up for free Email at http://ureg.home.net.my/
---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Problem with mktime, need to add 30 days to current date

2003-08-19 Thread James Johnson
Sorry about the previous post. 

Hi,

I need to make a date that is 30 days from the current date, and, am
having problems with mktime

Here's what I've tried:

$endDate=date('Y-m-d',mktime(0,0,0,date('m',time()),30,date('y',time()))
);

Return this: 2003-08-30

Is there an easy way to do this?

Thanks,
James


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Problem with mktime, need to add 30 days to current date

2003-08-19 Thread James Johnson
Hi,

I need to make a date that is 30 days from the current date, and, am
having problems with mktime

Here's what I've tried:


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] problem with mktime

2003-06-26 Thread anders thoresson
The following line of code doesn't work for me:

$previous_issue_unixdate = mktime(0, 0, 0, $previous_issue_month, 
$previous_issue_day, $previous_issue_year, 0);

$previous_issue_month is set to 06, _issue_day is 30 and _issue_year to 
2003. Still $previous_issue_unixdate is emtpy.

--
anders thoresson
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Problem with mktime()

2002-05-20 Thread Rasmus Lerdorf

08 and 09 are not real numbers.  Any number starting with a 0 is an octal
number which means you can only use digits 0-7

Drop the leading 0 and everything will work.

-Rasmus

On Mon, 20 May 2002, Johannes Tyra [BrainData] wrote:

> Hi,
>
> I want to read out the asterisk from a birthdate.
>
> First off all I need the timestamp:
>
>   $startDate['Steinbock'] = mktime (0, 0, 0, 12, 22,
> 1999);
>   $startDate['Wassermann']= mktime (0, 0, 0, 01, 21,
> 2000);
>   $startDate['Fisch'] = mktime (0, 0, 0, 02, 21,
> 2000);
>   $startDate['Widder']= mktime (0, 0, 0, 03, 21,
> 2000);
>   $startDate['Stier'] = mktime (0, 0, 0, 04, 21,
> 2000);
>   $startDate['Zwilling']  = mktime (0, 0, 0, 05, 21,
> 2000);
>   $startDate['Krebs'] = mktime (0, 0, 0, 06, 22,
> 2000);
>   $startDate['Löwe']  = mktime (0, 0, 0, 07, 23,
> 2000);
>   $startDate['Jungfrau']  = mktime (0, 0, 0, 08, 24,
> 2000);
>   $startDate['Waage'] = mktime (0, 0, 0, 09, 24,
> 2000);
>   $startDate['Skorpion']  = mktime (0, 0, 0, 10, 24,
> 2000);
>   $startDate['Schütze']   = mktime (0, 0, 0, 11, 23,
> 2000);
>   $startDate['Steinbock2']= mktime (0, 0, 0, 12, 22,
> 2000);
>
> but with 'Jungfrau' AND 'Waage' something is wrong!!
>
> if I want to debug this lines with:
>
>   echo date("m - Y",$startDate['Steinbock'])."";
>   echo date("m - Y",$startDate['Wassermann'])."";
>   echo date("m - Y",$startDate['Fisch'])."";
>   echo date("m - Y",$startDate['Widder'])."";
>   echo date("m - Y",$startDate['Stier'])."";
>   echo date("m - Y",$startDate['Zwilling'])."";
>   echo date("m - Y",$startDate['Krebs'])."";
>   echo date("m - Y",$startDate['Löwe'])."";
>   echo date("m - Y",$startDate['Jungfrau'])."";
>   echo date("m - Y",$startDate['Waage'])."";
>   echo date("m - Y",$startDate['Skorpion'])."";
>   echo date("m - Y",$startDate['Schütze'])."";
>   echo date("m - Y",$startDate['Steinbock2'])."";
>
> to read out the month and year of the asterisks PHP returns:
>
> 12 - 1999
> 01 - 2000
> 02 - 2000
> 03 - 2000
> 04 - 2000
> 05 - 2000
> 06 - 2000
> 07 - 2000
> 12 - 1999  error
> 12 - 1999  error
> 10 - 2000
> 11 - 2000
> 12 - 2000
>
> all other asterisks are ok...
>
> Does anyone know how to fix it??
> Or is it a bug??
> Anyone knows a better idea to get the asterisk from a given date???
>
> Thanx...
>
> --
> Mit freundlichem Gruß,
> Johannes Tyra
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Problem with mktime()

2002-05-20 Thread Dan Hardiker

> $startDate['Jungfrau'] = mktime (0, 0, 0, 08, 24, 2000);
> $startDate['Waage']= mktime (0, 0, 0, 09, 24, 2000);

Replace 08 and 09 with 8 and 9 respectivly and you will have the effect
you desire.
-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Problem with mktime()

2002-05-20 Thread Johannes Tyra [BrainData]

Hi,

I want to read out the asterisk from a birthdate.

First off all I need the timestamp:

$startDate['Steinbock'] = mktime (0, 0, 0, 12, 22,
1999);
$startDate['Wassermann']= mktime (0, 0, 0, 01, 21,
2000);
$startDate['Fisch'] = mktime (0, 0, 0, 02, 21,
2000);
$startDate['Widder']= mktime (0, 0, 0, 03, 21,
2000);
$startDate['Stier'] = mktime (0, 0, 0, 04, 21,
2000);
$startDate['Zwilling']  = mktime (0, 0, 0, 05, 21,
2000);
$startDate['Krebs'] = mktime (0, 0, 0, 06, 22,
2000);
$startDate['Löwe']  = mktime (0, 0, 0, 07, 23,
2000);
$startDate['Jungfrau']  = mktime (0, 0, 0, 08, 24,
2000);
$startDate['Waage'] = mktime (0, 0, 0, 09, 24,
2000);
$startDate['Skorpion']  = mktime (0, 0, 0, 10, 24,
2000);
$startDate['Schütze']   = mktime (0, 0, 0, 11, 23,
2000);
$startDate['Steinbock2']= mktime (0, 0, 0, 12, 22,
2000);

but with 'Jungfrau' AND 'Waage' something is wrong!!

if I want to debug this lines with:

echo date("m - Y",$startDate['Steinbock'])."";
echo date("m - Y",$startDate['Wassermann'])."";
echo date("m - Y",$startDate['Fisch'])."";
echo date("m - Y",$startDate['Widder'])."";
echo date("m - Y",$startDate['Stier'])."";
echo date("m - Y",$startDate['Zwilling'])."";
echo date("m - Y",$startDate['Krebs'])."";
echo date("m - Y",$startDate['Löwe'])."";
echo date("m - Y",$startDate['Jungfrau'])."";
echo date("m - Y",$startDate['Waage'])."";
echo date("m - Y",$startDate['Skorpion'])."";
echo date("m - Y",$startDate['Schütze'])."";
echo date("m - Y",$startDate['Steinbock2'])."";

to read out the month and year of the asterisks PHP returns:

12 - 1999
01 - 2000
02 - 2000
03 - 2000
04 - 2000
05 - 2000
06 - 2000
07 - 2000
12 - 1999  error
12 - 1999  error
10 - 2000
11 - 2000
12 - 2000

all other asterisks are ok...

Does anyone know how to fix it??
Or is it a bug??
Anyone knows a better idea to get the asterisk from a given date???

Thanx...

-- 
Mit freundlichem Gruß,
Johannes Tyra


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php