[PHP] Re: Time zone in date function

2012-01-31 Thread Ian
On 31/01/2012 01:55, Ron Piggott wrote:
 
 On my clients account when I use “echo date(‘D, d M Y H:i:s');” the output is 
 5 hours ahead of us.  How do I change it to my local time?  Is there a way to 
 specify “Eastern” time zone?
 
 I expect this would work:
 
 echo date(‘D, d M Y H:i:s' , ( strtotime( date(‘D, d M Y H:i:s') – 21600  ) ) 
 );
 
 I would prefer to specify Eastern time, so if the web host changes a server 
 setting it will remain in Eastern time zone.  Ron

Hi Ron,

I use this function to get the current time in a particular timezone:

?php
/**
 * Return the current local time by timezone name
 * @param string $timezone
 * @return array
 * @author Ian Gibbons
 */
function getNowByTimezone($timezone){
$remote_timezone= new DateTimeZone($timezone);
$remote_time= new DateTime(now, $remote_timezone);

return getDate(strtotime($remote_time-format(Y-m-d H:i:s)));
}
?

Example:

?

$london_time = getNowByTimezone(Europe/London);
echo date(D, d M Y H:i:s, $london_time[0]);

?

Regards

Ian


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



[PHP] Re: Time zone in date function

2012-01-31 Thread Jonesy
On Tue, 31 Jan 2012 14:57:41 +1300, Simon J Welsh wrote:
 On 31/01/2012, at 2:55 PM, Ron Piggott wrote:

 
 On my clients account when I use ?echo date(?D, d M Y H:i:s');? the output 
 is 5 hours ahead of us.  How do I change it to my local time?  Is there a 
 way to specify ?Eastern? time zone?
 
 I expect this would work:
 
 echo date(?D, d M Y H:i:s' , ( strtotime( date(?D, d M Y H:i:s') ? 21600  ) 
 ) );
 
 I would prefer to specify Eastern time, so if the web host changes a server 
 setting it will remain in Eastern time zone.  Ron

 You can set the timezone for your script using date_default_timezone_set() 
 http://php.net/manual/en/function.date-default-timezone-set.php

(wrap your lines, folks!)

Is there a reason _not_ to use viz:

putenv(TZ=America/Anguilla);  
 ??

Or, is it simple Just The Linux Way(tm) , i.e. there's 
always more than one way to do a 'thing'?

Jonesy
-- 
  Marvin L Jones| jonz  | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
* Killfiling google  banter.com: jonz.net/ng.htm


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



Re: [PHP] Re: Time zone in date function

2012-01-31 Thread Matijn Woudt
On Tue, Jan 31, 2012 at 4:22 PM, Jonesy gm...@jonz.net wrote:
 On Tue, 31 Jan 2012 14:57:41 +1300, Simon J Welsh wrote:
 On 31/01/2012, at 2:55 PM, Ron Piggott wrote:


 On my clients account when I use ?echo date(?D, d M Y H:i:s');? the output 
 is 5 hours ahead of us.  How do I change it to my local time?  Is there a 
 way to specify ?Eastern? time zone?

 I expect this would work:

 echo date(?D, d M Y H:i:s' , ( strtotime( date(?D, d M Y H:i:s') ? 21600  ) 
 ) );

 I would prefer to specify Eastern time, so if the web host changes a server 
 setting it will remain in Eastern time zone.  Ron

 You can set the timezone for your script using date_default_timezone_set() 
 http://php.net/manual/en/function.date-default-timezone-set.php

 (wrap your lines, folks!)

 Is there a reason _not_ to use viz:

        putenv(TZ=America/Anguilla);
  ??

 Or, is it simple Just The Linux Way(tm) , i.e. there's
 always more than one way to do a 'thing'?

 Jonesy

From the PHP Manual:
every call to a date/time function will generate a E_NOTICE if the
timezone isn't valid, and/or a E_WARNING message if using the system
settings or the TZ environment variable.

So that will generate E_WARNING messages.

- Matijn

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



[PHP] Re: Time zone in date function

2012-01-31 Thread Jonesy
On Tue, 31 Jan 2012 17:15:48 +0100, Matijn Woudt wrote:
 On Tue, Jan 31, 2012 at 4:22 PM, Jonesy gm...@jonz.net wrote:

 Is there a reason _not_ to use viz:

        putenv(TZ=America/Anguilla);
  ??

 Or, is it simple Just The Linux Way(tm) , i.e. there's
 always more than one way to do a 'thing'?

 From the PHP Manual:
 every call to a date/time function will generate a E_NOTICE if the
 timezone isn't valid, and/or a E_WARNING message if using the system
 settings or the TZ environment variable.

 So that will generate E_WARNING messages.

Ya, but...  I am using that _very_ statement and get no E_WARNING.
The timezone illustrated _is_ valid.  IWFM.
I believe the PHP manual is 'awkwardly' written in this case.
Better would be if that *whole* sentence above was re-written beginning 
with If the timezone is invalid, every call  , and/or an 
E_WARNING ...  
As written, it could be construed to mean an E_WARNING is _always_
generated for setting the TZ environment variable.

Jonesy


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



Re: [PHP] Re: Time zone discrepancy - America/New_York = CDT?

2009-11-01 Thread Mattias Thorslund

The output I get (after adding newlines to the output) is:
America/New_York
EST
EST
EST

PHP 5.2.10. I suspect this comes from the operating system. Maybe update 
your tzdata package if you're on a Linux system.


Cheers,

Mattias

Nathan Lebovic wrote:

Sorry there was a typo in that output. This is what I'm getting:

date_default_timezone_set(America/New_York);
echo date(e); //output America/New_York
echo date(T); //output CST

date_default_timezone_set(EST);
echo date(e); //output EST
echo date(T); //output EST

- Nathan


On Sun, Nov 1, 2009 at 3:48 AM, Nathan Lebovic nlebo...@gmail.com wrote:
  

I'm using PHP 5.2.6; I just updated timezones with PECL timezonedb to make sure 
that wasn't the problem.

These are the results that I'm getting, which I cannot figure out:

date_default_timezone_set(America/New_York);
echo date(e); //output America/New_York
echo date(T); //output CST

date_default_timezone_set(EST);
echo date(e); //output EST
echo date(T); //output CDT

Any ideas?

Thanks,

- Nathan



  



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



[PHP] Re: Time Problem: always ten past xx

2009-10-06 Thread Carsten Wiedmann
Matthias Laug schrieb:
 var_dump(strftime(%d.%m.%Y %H:%m,$time));
   ---^
 The minutes are always 10, no matter what time I get.

%m = month
%M = minute

Regards,
Carsten


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



[PHP] Re: Time keeping in DB

2009-08-05 Thread Ollisso
On Wed, 05 Aug 2009 22:18:31 +0300, Shawn McKenzie nos...@mckenzies.net  
wrote:



So, obviously not PHP related, but I'm looking for thoughts on the best
way to record time sheets in a DB.  A time sheet for hours worked per
day, not like a time clock where you start and stop.

The two possibilities that I have thought of are (these are simplistic,
of course I'll be storing references to the user, the project code etc.):

1. One record for each 7 day week (year, week_num, d1, d2, d3, d4, d5,
d6, d7) where the dX field holds the hours worked
2. One record for each day (date, hours)



In simpliest scenarios, it is better to use first approach.
it is best in terms of simplicity, usage, space consumption.

in case if you need to store extra information about hours (at which  
location, at which time started, etc, ), then it might be better to split  
it to following tbles:


1. Time sheet.
All basic information about sheet: user, year, week number, etc. whatever  
you need.

Just add unique id of this timesheet
Here you can also add cached version of hours per day.

2. Day information:
timesheetId, dayId(1-7),  hours, a lot of extra fields for this day.

Of course, this is applicable only if you have a lot of extra information  
for each day.

If not, then use easiet approach.






--

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



[PHP] Re: Time keeping in DB

2009-08-05 Thread Ralph Deffke
sorry man, but a good data design keeps only data in a table u can not
calculate. in ur case that would be only date start and end time.
refernces to user and project/tasks in other tables.

ur time sheet is definately a job for a report. that type of design limits u
to nothing. a user can start ans stop as many times he wants a day or time
range. u can report any number of time bits to any number of project a day
or time range

Ralph

Shawn McKenzie nos...@mckenzies.net wrote in message
news:5e.47.03459.7ead9...@pb1.pair.com...
 So, obviously not PHP related, but I'm looking for thoughts on the best
 way to record time sheets in a DB.  A time sheet for hours worked per
 day, not like a time clock where you start and stop.

 The two possibilities that I have thought of are (these are simplistic,
 of course I'll be storing references to the user, the project code etc.):

 1. One record for each 7 day week (year, week_num, d1, d2, d3, d4, d5,
 d6, d7) where the dX field holds the hours worked
 2. One record for each day (date, hours)

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com



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



[PHP] Re: Time keeping in DB

2009-08-05 Thread Ben Dunlap
 sorry man, but a good data design keeps only data in a table u can not
 calculate. in ur case that would be only date start and end time.
 refernces to user and project/tasks in other tables.
 
 ur time sheet is definately a job for a report. that type of design limits u
 to nothing. a user can start ans stop as many times he wants a day or time
 range. u can report any number of time bits to any number of project a day
 or time range

I agree (unless the app just doesn't have access to the start/stop data).

Ben

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



[PHP] Re: Time keeping in DB

2009-08-05 Thread Shawn McKenzie
Ben Dunlap wrote:
 sorry man, but a good data design keeps only data in a table u can not
 calculate. in ur case that would be only date start and end time.
 refernces to user and project/tasks in other tables.

 ur time sheet is definately a job for a report. that type of design limits u
 to nothing. a user can start ans stop as many times he wants a day or time
 range. u can report any number of time bits to any number of project a day
 or time range
 
 I agree (unless the app just doesn't have access to the start/stop data).
 
 Ben

OK, I think I understand most points except the start and stop time.
Every time sheet I have used, SAP and several other smaller ones, I
enter a weeks worth of time data like:

Project Sun Mon TuesWed ThurFri Sat
---
Grill steaks8   8   8   8   0   
Vacation0   0   0   0   8

So why wouldn't I store the dates and the hours instead of start and
stop times?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Time keeping in DB

2009-08-05 Thread Ben Dunlap
 OK, I think I understand most points except the start and stop time.
 Every time sheet I have used, SAP and several other smaller ones, I
 enter a weeks worth of time data like:
 
 Project   Sun Mon TuesWed ThurFri Sat
 ---
 Grill steaks  8   8   8   8   0   
 Vacation  0   0   0   0   8
 
 So why wouldn't I store the dates and the hours instead of start and
 stop times?
 

Maybe it comes down to what the users of the app prefer (or what you prefer, if
you're building this app for yourself).

From a user's perspective, I like start/stop data-entry better. I love that I
can do this in Freshbooks, for example -- just click 'start' and then later
click 'stop', 'log hours' -- and I never have to think about things like how
many hours are there between 11:26am and 2:12pm?

I think Ralph's point was that start/stop data is about as granular as any sort
of time-keeping data gets, so if you store only start/stop data, you have
ultimate flexibility in the way you can manipulate that data in your app.

And it's probably a reasonable generalization that the most forward-looking
database designs will store data in as simple and raw a form as possible. Or as
Ralph put it, a good data design keeps only data in a table u can not
calculate.

With start/stop data, you could create weekly timesheets like the one above, in
PHP -- and you could also figure out how many hours you log before noon, on
average, etc.

On the other hand, if the simplest data you enter is already the implicit
result of a calculation (stop_time - start_time), you've limited the
flexibility of your app from the get-go. But maybe that limitation isn't
significant for the app you're building.

Ben

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



[PHP] Re: Time keeping in DB

2009-08-05 Thread Ralph Deffke
as I said, the job is to store a time sheet.
u came up with:

1. One record for each 7 day week (year, week_num, d1, d2, d3, d4, d5,
d6, d7) where the dX field holds the hours worked
2. One record for each day (date, hours)

it seems that just the first record is fine. in a data design u dont hold
the same data twice. so why to use the second record?

if u want to use two tables, then the d1-d7 fields should not be in that
record.
if u use the second record it could be that there are two records with the
same date, what to do with it?, whichone is valid? date-time field are a bit
complicated and it is not a good idear to do them unique, that is because
internally those field are stored in databases as long unsigned integer
often the passed seconds since 1982 (the birth of the ibm pc) or even
miliseconds. that means there is always internally a big juggling to format
the date.

Ralph
ralph_def...@yahoo.de

Shawn McKenzie nos...@mckenzies.net wrote in message
news:e9.66.14714.5b80a...@pb1.pair.com...
 Ben Dunlap wrote:
  sorry man, but a good data design keeps only data in a table u can not
  calculate. in ur case that would be only date start and end time.
  refernces to user and project/tasks in other tables.
 
  ur time sheet is definately a job for a report. that type of design
limits u
  to nothing. a user can start ans stop as many times he wants a day or
time
  range. u can report any number of time bits to any number of project a
day
  or time range
 
  I agree (unless the app just doesn't have access to the start/stop
data).
 
  Ben

 OK, I think I understand most points except the start and stop time.
 Every time sheet I have used, SAP and several other smaller ones, I
 enter a weeks worth of time data like:

 Project Sun Mon Tues Wed Thur Fri Sat
 ---
 Grill steaks 8 8 8 8 0
 Vacation 0 0 0 0 8

 So why wouldn't I store the dates and the hours instead of start and
 stop times?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com



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



[PHP] Re: Time keeping in DB

2009-08-05 Thread Shawn McKenzie
Ralph Deffke wrote:
 as I said, the job is to store a time sheet.
 u came up with:
 
 1. One record for each 7 day week (year, week_num, d1, d2, d3, d4, d5,
 d6, d7) where the dX field holds the hours worked
 2. One record for each day (date, hours)
 
 it seems that just the first record is fine. in a data design u dont hold
 the same data twice. so why to use the second record?
 
 if u want to use two tables, then the d1-d7 fields should not be in that
 record.
 if u use the second record it could be that there are two records with the
 same date, what to do with it?, whichone is valid? date-time field are a bit
 complicated and it is not a good idear to do them unique, that is because
 internally those field are stored in databases as long unsigned integer
 often the passed seconds since 1982 (the birth of the ibm pc) or even
 miliseconds. that means there is always internally a big juggling to format
 the date.
 
 Ralph
 ralph_def...@yahoo.de
 
 Shawn McKenzie nos...@mckenzies.net wrote in message
 news:e9.66.14714.5b80a...@pb1.pair.com...
 Ben Dunlap wrote:
 sorry man, but a good data design keeps only data in a table u can not
 calculate. in ur case that would be only date start and end time.
 refernces to user and project/tasks in other tables.

 ur time sheet is definately a job for a report. that type of design
 limits u
 to nothing. a user can start ans stop as many times he wants a day or
 time
 range. u can report any number of time bits to any number of project a
 day
 or time range
 I agree (unless the app just doesn't have access to the start/stop
 data).
 Ben
 OK, I think I understand most points except the start and stop time.
 Every time sheet I have used, SAP and several other smaller ones, I
 enter a weeks worth of time data like:

 Project Sun Mon Tues Wed Thur Fri Sat
 ---
 Grill steaks 8 8 8 8 0
 Vacation 0 0 0 0 8

 So why wouldn't I store the dates and the hours instead of start and
 stop times?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 
 

In my original post I said those were the two options, so I would
choose 1 or 2 or something else.  Not both.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Time keeping in DB

2009-08-05 Thread Shawn McKenzie
Ben Dunlap wrote:
 OK, I think I understand most points except the start and stop time.
 Every time sheet I have used, SAP and several other smaller ones, I
 enter a weeks worth of time data like:

 Project  Sun Mon TuesWed ThurFri Sat
 ---
 Grill steaks 8   8   8   8   0   
 Vacation 0   0   0   0   8

 So why wouldn't I store the dates and the hours instead of start and
 stop times?

 
 Maybe it comes down to what the users of the app prefer (or what you prefer, 
 if
 you're building this app for yourself).
 
 From a user's perspective, I like start/stop data-entry better. I love that I
 can do this in Freshbooks, for example -- just click 'start' and then later
 click 'stop', 'log hours' -- and I never have to think about things like how
 many hours are there between 11:26am and 2:12pm?
 
 I think Ralph's point was that start/stop data is about as granular as any 
 sort
 of time-keeping data gets, so if you store only start/stop data, you have
 ultimate flexibility in the way you can manipulate that data in your app.
 
 And it's probably a reasonable generalization that the most forward-looking
 database designs will store data in as simple and raw a form as possible. Or 
 as
 Ralph put it, a good data design keeps only data in a table u can not
 calculate.
 
 With start/stop data, you could create weekly timesheets like the one above, 
 in
 PHP -- and you could also figure out how many hours you log before noon, on
 average, etc.
 
 On the other hand, if the simplest data you enter is already the implicit
 result of a calculation (stop_time - start_time), you've limited the
 flexibility of your app from the get-go. But maybe that limitation isn't
 significant for the app you're building.
 
 Ben

I see.  I'm coming at this from an IT consultant perspective, where
you're just like an employee, you work M-F 8 or so hours a day normally.
 So really your just filling it out for billing but it would normally be
8 hours M-F sometimes with vacation etc.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Time zones and $_ENV vs getenv

2008-11-04 Thread John Coppens
On Mon, 3 Nov 2008 13:01:14 -0200
[EMAIL PROTECTED] (John Coppens) wrote:

 I'm confused... Can someone point me to some more tests I could do?

Solved.

Apparently the apachectl start/stop/restart script didn't work correctly,
or wasn't able to do its work. I _thought_ I had restart apache after
each modification, but it just continued running.

John

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



[PHP] Re: time or date picker ?

2007-03-19 Thread Manuel Lemos
Hello,

on 03/19/2007 04:11 PM Alain Roger said the following:
 Hi,
 
 I've already seen some webpages which include a time or date picker (like a
 calendar) written in PHP and on which user could type the year and after,
 select the month and date (using month).
 I'm looking for something like that.
 
 Where can i find one for free ?

You may want to take a look at this forms generation class that comes
with a plug-in precisely for what you ask.

http://www.phpclasses.org/formsgeneration

Here you can see a live example of what date picker:

http://www.meta-language.net/forms-examples.html?example=test_date_input

Here you can watch a tutorial video with a section that explains about
this plug-in:

http://www.phpclasses.org/browse/video/1/package/1/section/plugin-date.html

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Re: Time-Zone juggling

2006-11-08 Thread Colin Guthrie
Going a bit OT but who cares :)

tedd wrote:
 I just wonder how they came up with the acronym of UTC for Coordinated
 Universal Time?

In 1970 the Coordinated Universal Time system was devised by an
international advisory group of technical experts within the
International Telecommunication Union (ITU). The ITU felt it was best to
designate a single abbreviation for use in all languages in order to
minimize confusion. Since unanimous agreement could not be achieved on
using either the English word order, CUT, or the French word order, TUC,
the acronym UTC was chosen as a compromise.

Copy+Paste from: http://tf.nist.gov/general/misc.htm#Anchor-14550

Col :)

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



[PHP] Re: Time-Zone juggling

2006-11-08 Thread tedd

At 7:06 PM + 11/8/06, Colin Guthrie wrote:

Going a bit OT but who cares :)

tedd wrote:

 I just wonder how they came up with the acronym of UTC for Coordinated
 Universal Time?


In 1970 the Coordinated Universal Time system was devised by an
international advisory group of technical experts within the
International Telecommunication Union (ITU). The ITU felt it was best to
designate a single abbreviation for use in all languages in order to
minimize confusion. Since unanimous agreement could not be achieved on
using either the English word order, CUT, or the French word order, TUC,
the acronym UTC was chosen as a compromise.

Copy+Paste from: http://tf.nist.gov/general/misc.htm#Anchor-14550

Col :)


Interesting, apparently ego's at work. As such, they could have used:

CUTC

Which stands for Coordinated Universal Time, with Croissant, no?

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: time zone problem

2005-08-31 Thread Satyam
Go to:

http://www.timeanddate.com/worldclock/custom.html?cities=51,31,1038,224,179

The numbers at the end are my personal selection of cities I care about, but 
you can change it and the cities database is a long one.  It is updated for 
daylight savings when applicable.

Satyam

Sergey [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi!
 I some problem:
 I have visitor's IP, country and  city. I need to define his GMT offset. 
 Have you such database GMT's offsets.
 I found many such list in Google but many countries has different GMT's 
 (Russia - 7!).
 Any idea? 

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



[PHP] Re: Time problem

2003-11-12 Thread Kim Steinhaug
Well,

If your into your programming, have a look at this one :
http://www.phpclasses.org/browse.html/package/1199.html

It does something else, but the same approach can be used to
format your readable dates. This wheel has surely been invented
already, so you probably should do some googling to find a
finnished class og function that does this for you.

Kim

Erin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi All,
 Sorry if this has been asked a 1000 times and if its easy to find in
the
 php manual but i cant seam to solve this.

 How do i convert a timestamp in to a normal readable time  date ie

 2003155023

 into

 11th November 2003 @ 15:50:23


 Many thanks, thought id ask someone is bound to have a snippet for this.



 Regards

 All



 Erin

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



[PHP] Re: time stamp screwing up

2003-01-06 Thread Scott Fletcher
Instead of the php function, 'time()'.  Try 'date()'.  Somethine like this

--clip--
?
//Long way around
date(Y).-.date(m).-.date(d);

//Shortcut
date(Y-m-d);
?
--clip--

You can customize the way you want the time format to be displayed.  You can
find it at http://www.php.net/manual/en/function.date.php and you'll see the
option for dates and times.

- - [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 hey guys could someone help me
 I have created a user login register system in  flash with PHP and Mysql.
 Everthing Now works fine aprt from the time stamp of when the user
 registered.

 Code ---
 // Get current date  time
 $time = time();
 // Connects to the Database.
 $Connect = mysql_connect($dbServer, $dbUser, $dbPass);
 mysql_select_db($dbName);
 // Preforms the SQL query to see if user name already exsists
 $query = SELECT name FROM contacts WHERE name='$name';
 $rs_contacts = mysql_query($query) or die(mysql_error());
 $row = mysql_fetch_assoc($rs_contacts);
 if ($row[name] == $name) {
 print loginT=UserName in Usechecklog=2;
 }else{
 $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES
 (NULL, '$name', '$pass', '$email', '$time');
 }


 It inserts -00-00
 instead of the current date

 ideas

 P.S
 I am a newbie try keeping reponse's simple please





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




[PHP] Re: time to seconds

2002-09-18 Thread Denis Basta

Hello,

Try this:
SELECT SUM(duration) AS summ, ..., ..., ..., FROM table1 WHERE condition
Hope it will help ya!

Regards,
Denis Basta.

Adi [EMAIL PROTECTED] wrote in message
008701c25ef1$01d94260$9600a8c0@adi">news:008701c25ef1$01d94260$9600a8c0@adi...
Hi, I have a table table1, with a column Duration time type(ex 00:12:30)
I want to make in PHP a sql selection:
SELECT * from table1 WHERE condition, and after that, to make sum of values
of column Duration and display it.
Any Help?

How to transform time in seconds, with php functions?
tx





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




Re: [PHP] Re: time to seconds

2002-09-18 Thread Marek Kilimajer

won't help, it's forbidden to mix aggregate columns with non aggregate 
without a group by clause. Make your first query and then the sum.

Denis Basta wrote:

Hello,

Try this:
SELECT SUM(duration) AS summ, ..., ..., ..., FROM table1 WHERE condition
Hope it will help ya!

Regards,
Denis Basta.

Adi [EMAIL PROTECTED] wrote in message
008701c25ef1$01d94260$9600a8c0@adi">news:008701c25ef1$01d94260$9600a8c0@adi...
Hi, I have a table table1, with a column Duration time type(ex 00:12:30)
I want to make in PHP a sql selection:
SELECT * from table1 WHERE condition, and after that, to make sum of values
of column Duration and display it.
Any Help?

How to transform time in seconds, with php functions?
tx





  



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




[PHP] Re: time stamp

2002-08-28 Thread David Robley

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 I am using PHP with MySQL and have a timestamp field in my db table.  What 
 would be the easiest way to get the newest timestamp out of the db?
 
 Thanks in Advance
 Steve

Use an ORDER BY on the timestamp field in your select statement, and use 
LIMIT to restrict the number of rows you retrieve (if you want a subset of 
rows).


-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] RE: time stamp

2002-08-28 Thread Lopez David E-r9374c

Steve

Try: SELECT MAX(field_timestamp) from table1;

David

 -Original Message-
 From: Steve Buehler [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 27, 2002 5:21 PM
 To: mysql; PHP
 Subject: time stamp
 
 
 I am using PHP with MySQL and have a timestamp field in my db 
 table.  What 
 would be the easiest way to get the newest timestamp out of the db?
 
 Thanks in Advance
 Steve
 
 
 --
 This message has been scanned for viruses and
 dangerous content by MailScanner, and is
 believed to be clean.
 ow3
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail 
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 

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




[PHP] RE: time stamp

2002-08-28 Thread Steve Buehler

Thank you David Lopez and David Robley.  That was what I was looking 
for.  Here is how I used it.

$date=getlastupdatetime(array(team_id = $team_id,
 season = $season,
 div_id = $div_id));
echo $date;

function getlastupdatetime($a){
 extract($a);
 $result=mysql_query (SELECT MAX(UNIX_TIMESTAMP(updated)) as 
epoch_time FROM games
 WHERE (hteam='$team_id' OR vteam='$team_id')
 AND sea_id = '$season' AND div_id = 
'$div_id');
 $date = mysql_result ($result, 0, 0);
 if(!$date){
 return;
 }else{
 return date(l dS of F Y h:i:s A O,$date);
 }
}


Which gives me the following line:
Wednesday 28th of August 2002 06:00:06 PM -0500

I was doing the following which was a bit more code and I wanted to use a 
little less code.  Plus it should make the search and processing quicker.

$date=getlastupdatetime(array(team_id = $team_id,
 season = $season,
 div_id = $div_id));
echo $date;

function getlastupdatetime($a){
 extract($a);
 $result=mysql_query(SELECT updated FROM games WHERE 
(hteam='$team_id' OR vteam='$team_id')
 AND sea_id = '$season' AND 
div_id = '$div_id');
 $b=0;
 while(($row=mysql_fetch_object($result))){
 if($row-updated  $b){
 $b=$row-updated;
 }
 }
 $date=$b;
 $year=substr($date,0,4);
 $month=substr($date,4,2);
 $day=substr($date,6,2);
 $hour=substr($date,8,2);
 $min=substr($date,10,2);
 if($hour = 12){$ap = pm;}else{$ap = am;}
 if($hour  12){$hour = $hour-12;}
 if(!$month){
 return nothing;
 }else{
 return $month-$day-$year $hour:$min $apbr;
 }
*/
}


Thank Again
Steve


At 08:28 AM 8/28/2002 -0700, you wrote:
Steve

Try: SELECT MAX(field_timestamp) from table1;

David

  -Original Message-
  From: Steve Buehler [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, August 27, 2002 5:21 PM
  To: mysql; PHP
  Subject: time stamp
 
 
  I am using PHP with MySQL and have a timestamp field in my db
  table.  What
  would be the easiest way to get the newest timestamp out of the db?
 
  Thanks in Advance
  Steve
 
 
  --
  This message has been scanned for viruses and
  dangerous content by MailScanner, and is
  believed to be clean.
  ow3
 
 
  -
  Before posting, please check:
 http://www.mysql.com/manual.php  (the manual)
 http://lists.mysql.com/  (the list archive)
 
  To request this thread, e-mail [EMAIL PROTECTED]
  To unsubscribe, e-mail
  [EMAIL PROTECTED]
  Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3



--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
ow3


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




[PHP] Re: Time to Calculate Time

2002-07-09 Thread Richard Lynch

i have variables $Start, $End each with a timestamp 2 hours apart
(2002070714, 2002070716) respectively
  01234567890123

How do i calculate those to timestamps to get the answer 2?

I've tried working them into unix timestamps and then calculating but no
luck...

any one got any ideas ??

I'm guessing these are coming from MySQL... If so, you can subtract the two
in MySQL much easier/faster than PHP...

http://mysql.com/

If not:

$s = mktime(substr($Start, 8, 2), substr($Start, 10, 2), substr($Start, 12,
2), substr($Start, 4, 2), substr($Start, 6, 2), substr($Start, 0, 4));
$e = mktime(substr($End, 8, 2), substr($End, 10, 2), substr($End, 12, 2),
substr($End, 4, 2), substr($End, 6, 2), substr($End, 0, 4));

$delta = $e - $s;


At this point, it boils down to the question -- Will it ever be, like,
*DAYS* instead of hours, or, more importantly, *MONTHS*?

Because as soon as you get into months or larger time units, it gets
complicated...

Until then, you can divide by 60, or 60*60, or 60*60*24 to get the number of
minutes, hours, days respectively...

-- 
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




[PHP] Re: Time to Calculate Time

2002-07-08 Thread Lord Loh.

?php
function getmicrotime(){
list($usec, $sec) = explode( ,microtime());
$time=$sec+$usec;
return $time;
}

$start=getmicrotime();
echo wasting time...br;
$i=0;
do{
$i++;
}while($i=100);
$stop=getmicrotime();
$difference=($stop-$start)/3600;
echo $start.br.$stop.br.$difference. Hours;
?

Does this help...

- Lord Loh



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




[PHP] RE: Time to Divide Lists? WAS: [PHP] MySQL - Creating The Database

2002-06-04 Thread Jay Blanchard

Quite frequently on this list and others there are questions where it is
obvious that the manual or list archives have not been searched. Heck, some
of these are cross posted to many lists where the sender may think that they
will get relevant information. On the MySQL list the footer even has this...

Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

But some have never, ever read it. The PHP list does not have anything in
its footer about searching the PHP archives or http://www.php.net, but it is
said so often that it should be common sense.

Maybe those things should be at the top of the e-mail.

There is a wide range of users out there, from absolute novice (where we all
were once) up to supreme-ruler-of-the-(insert language/database/systems
name)-universe. Novices may need to be gently reminded to search the
archives and/or documentation and/or FAQ (after all, the same questions come
up every week, and anyone who has subscribed to any list like this knows
what questions will be posed this week).

So I have an idea... :0

Should we request that there be a list for intermediate/advanced users
seperate from the general list? Those at the intermediate (and above) stage
could monitor the general list and help newbies, while having a list where
it is understood that persons thereon would have a more than passing
knowledge of the subject matter.

You may flame me now...

Jay



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




Re: [PHP] RE: Time to Divide Lists? WAS: [PHP] MySQL - Creating TheDatabase

2002-06-04 Thread Rasmus Lerdorf

If you had searched the list archives yourself you would have seen that
this has been suggested a few times and rejected each time because nobody
would stick around and answer the newbie questions and newbies, being
newbies, would figure out where the people who can answer their questions
hang out and ask there. So nothing would have been gained. But yes, we
could add something to the footer.

-Rasmus

On Tue, 4 Jun 2002, Jay Blanchard wrote:

 Quite frequently on this list and others there are questions where it is
 obvious that the manual or list archives have not been searched. Heck, some
 of these are cross posted to many lists where the sender may think that they
 will get relevant information. On the MySQL list the footer even has this...

 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 But some have never, ever read it. The PHP list does not have anything in
 its footer about searching the PHP archives or http://www.php.net, but it is
 said so often that it should be common sense.

 Maybe those things should be at the top of the e-mail.

 There is a wide range of users out there, from absolute novice (where we all
 were once) up to supreme-ruler-of-the-(insert language/database/systems
 name)-universe. Novices may need to be gently reminded to search the
 archives and/or documentation and/or FAQ (after all, the same questions come
 up every week, and anyone who has subscribed to any list like this knows
 what questions will be posed this week).

 So I have an idea... :0

 Should we request that there be a list for intermediate/advanced users
 seperate from the general list? Those at the intermediate (and above) stage
 could monitor the general list and help newbies, while having a list where
 it is understood that persons thereon would have a more than passing
 knowledge of the subject matter.

 You may flame me now...

 Jay



 --
 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] RE: Time to Divide Lists? WAS: [PHP] MySQL - Creating The Database

2002-06-04 Thread Jay Blanchard

[snip]
If you had searched the list archives yourself you would have seen that
this has been suggested a few times and rejected each time because nobody
would stick around and answer the newbie questions and newbies, being
newbies, would figure out where the people who can answer their questions
hang out and ask there. So nothing would have been gained. But yes, we
could add something to the footer.
[/snip]

I did check the archives, but I was hoping that maybe the climate had
changed enough for this to happen. Oh well, you can't blame a guy for
trying. ;)

Jay



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




Re: [PHP] RE: Time to Divide Lists? WAS: [PHP] MySQL - Creating The Database

2002-06-04 Thread Jason Wong

On Tuesday 04 June 2002 21:22, Rasmus Lerdorf wrote:
 If you had searched the list archives yourself you would have seen that
 this has been suggested a few times and rejected each time because nobody
 would stick around and answer the newbie questions and newbies, being
 newbies, would figure out where the people who can answer their questions
 hang out and ask there. So nothing would have been gained. But yes, we
 could add something to the footer.

And not to mention that it will just increase the amount of cross-posting.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
It would seem that evil retreats when forcibly confronted.
-- Yarnek of Excalbia, The Savage Curtain, stardate 5906.5
*/


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




[PHP] Re: Time/date function MYSQL-UNIX

2002-05-24 Thread Hugh Bothwell


Peter [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Is there a built in PHP function which will convert a MySQL type date
 (DDMM or whatever) into a unix timestamp so it can be used with the
 other PHP time and date functions?

 I'm currently using substr() to extract bits of the date so it displays as
 DD / MM /  but it's annoying!


SELECT
id, UNIX_TIMESTAMP(mydate) AS mydatestamp
FROM mytable

then  $row['mydatestamp'] is your unix timestamp.



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




[PHP] Re: Time/date function MYSQL-UNIX

2002-05-24 Thread Peter

OK cheers. I'll have a try.
I saw UNIX_TIMESTAMP() in the MySQL docs but I didn't quite understand it
(PHP is MUCH easier for me!)
Thanks for the example too


Peter [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Is there a built in PHP function which will convert a MySQL type date
 (DDMM or whatever) into a unix timestamp so it can be used with the
 other PHP time and date functions?

 I'm currently using substr() to extract bits of the date so it displays as
 DD / MM /  but it's annoying!





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




[PHP] Re: time limit ?

2002-03-05 Thread ??

However,
the value cannot transfer by this method.
I want the value transfer to a txt file ,although it is not completed

--
?
http://fansing.hk.st/
ACG(!)
http://acgzone.hk.st/
George Whiffen [EMAIL PROTECTED]
???:[EMAIL PROTECTED]


ÁC¬P wrote:

 How can I set a time limit for a form made by PHP (i.e.the value will auto
 transfer after a certain time)
 --
 Ác¬P¤u§@«Ç
 http://fansing.hk.st/
 ACG¤¬°Ê°Ï°ì(¤j®a¦h¨Ç¨Ó¶K¹Ï§a!)
 http://acgzone.hk.st/

HTML forms execute in the client's browser, which does not care at all
whether
the form came from static html file, php, Perl, whatever.

The simplest way to get a browser to time out is with a  META refresh html
tag in the HEADER part of your page e.g.

META HTTP-EQUIV=Refresh CONTENT=15;
URL=http://www.mysite.com/too_long.html;.

This would automatically redirect to the too_long.html page after 15
seconds.

George




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




[PHP] Re: time limit ?

2002-03-04 Thread George Whiffen



ÁC¬P wrote:

 How can I set a time limit for a form made by PHP (i.e.the value will auto
 transfer after a certain time)
 --
 Ác¬P¤u§@«Ç
 http://fansing.hk.st/
 ACG¤¬°Ê°Ï°ì(¤j®a¦h¨Ç¨Ó¶K¹Ï§a!)
 http://acgzone.hk.st/

HTML forms execute in the client's browser, which does not care at all whether
the form came from static html file, php, Perl, whatever.

The simplest way to get a browser to time out is with a  META refresh html
tag in the HEADER part of your page e.g.

META HTTP-EQUIV=Refresh CONTENT=15;
URL=http://www.mysite.com/too_long.html;.

This would automatically redirect to the too_long.html page after 15 seconds.

George


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




RE: [PHP] Re: time limit ?

2002-03-04 Thread Darren Gamble

Good day,

That won't submit the form, unfortunately.  It'll just redirect the user to
the page without submitting the contents of the form.

If the browser supports it, one can use javascript to submit the form after
a certain amount of seconds have elapsed.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: George Whiffen [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 12:16 PM
To: [EMAIL PROTECTED]; Ác¬P
Subject: [PHP] Re: time limit ?




ÁC¬P wrote:

 How can I set a time limit for a form made by PHP (i.e.the value will auto
 transfer after a certain time)
 --
 Ác¬P¤u§@«Ç
 http://fansing.hk.st/
 ACG¤¬°Ê°Ï°ì(¤j®a¦h¨Ç¨Ó¶K¹Ï§a!)
 http://acgzone.hk.st/

HTML forms execute in the client's browser, which does not care at all
whether
the form came from static html file, php, Perl, whatever.

The simplest way to get a browser to time out is with a  META refresh html
tag in the HEADER part of your page e.g.

META HTTP-EQUIV=Refresh CONTENT=15;
URL=http://www.mysite.com/too_long.html;.

This would automatically redirect to the too_long.html page after 15
seconds.

George


-- 
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




[PHP] Re: Time Zone Offset?

2002-01-13 Thread Jim Winstead

Marvin Sanders [EMAIL PROTECTED] wrote:
 I'm using the PHP date() function on my site, but since my hosting company
 (Pair Networks) is on the East Coast and I'm on the West Coast, everything
 shows as three hours later (for most of my visitors, anyway). Pair tells me
 there's no setting I can make on my account to change the server time zone.
 
 Can anyone recommend a way to set an offset for the date() function in PHP?
 (I searched on php.net and couldn't find anything.)

putenv(TZ=PST8PDT);

jim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Time function question/

2001-12-27 Thread George Nicolae

try date(d-M-Y,rand (mktime(0,0,0,1,1,1970),mktime(0,0,0,12,31,1985)))
mktime works only from January 1 1970
--


Best regards,
George Nicolae
IT Manager
___
X-Playin - Professional Web Design
www.x-playin.f2s.com



Mehmet Kamil Erisen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,
 Can anybody suggest a function that will generate a random
 date between
 01-Jan-1967
 31-Dec-1985

 thanks.


 =
 Mehmet Erisen
 http://www.erisen.com

 __
 Do You Yahoo!?
 Send your FREE holiday greetings online!
 http://greetings.yahoo.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: time stuff

2001-12-10 Thread Hugh Bothwell


[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 suppose the date is 12-10-01
 --
 $timestamp = time();
 
 //this is the sent on date
 $yd_expl = explode(':',08-01-01);

Uh, better make that
... = explode('-', '08-01-01');

Otherwise I think you'll get { 6 } instead of { 8, 1, 1 }



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Time out for file()?

2001-11-15 Thread Richard Lynch

Jean-Arthur Silve wrote:

 Hi !
 
 I use the file function for accessing to pages on another server.
 
 It works perfectly.
 
 But if the server does not respond or is too long to send datas, the file
 function wait too long..
 
 Is there a way to tune the time out ?? I would like that id the server
 does not respond, the function return in few seconds only.
 
 I thought to a solution using :
 
 set_time_limit(2);
 register_shutdown_function(func);
 file(myurl);
 set_time_limit(30);
 func();
 
 In this example if the file function takes more than 2 seconds, then
 func() would be called. If the file function does not time out, then then
 func is called too...
 
 But may be there is a cleanest way to do this (I checked the manual,
 somethink like socket_set_timeout), in the way that if the time function
 timed out then the script continues normally, returning an error:
 
 tuning the time out(2);
 $f=file(myurl);
 if ($f==false)
  // Timed out
 else
  // ok
 

Use http://php.net/fsockopen, as suggested, *BUT* use the recently added 
optional arguments to it.  You will need to have a reasonably current 
version of PHP to do this.

The socket_blocking and socket_timeout are only useful *AFTER* you've 
opened the socket.

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Time out for file()?

2001-11-14 Thread _lallous

from the manual
?php
$fp = fsockopen(www.php.net, 80);
if(!$fp) {
echo Unable to open\n;
} else {
fputs($fp,GET / HTTP/1.0\n\n);
$start = time();
socket_set_timeout($fp, 2);
$res = fread($fp, 2000);
//var_dump(socket_get_status($fp));
fclose($fp);
print $res;
}
?
this will grab a file too using the socket functions, the
socket_set_timeout()'s first param is expected to be a socket handle.

Jean-Arthur Silve [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi !

I use the file function for accessing to pages on another server.

It works perfectly.

But if the server does not respond or is too long to send datas, the file
function wait too long..

Is there a way to tune the time out ?? I would like that id the server does
not respond, the function return in few seconds only.

I thought to a solution using :

set_time_limit(2);
register_shutdown_function(func);
file(myurl);
set_time_limit(30);
func();

In this example if the file function takes more than 2 seconds, then func()
would be called. If the file function does not time out, then then func is
called too...

But may be there is a cleanest way to do this (I checked the manual,
somethink like socket_set_timeout), in the way that if the time function
timed out then the script continues normally, returning an error:

tuning the time out(2);
$f=file(myurl);
if ($f==false)
 // Timed out
else
 // ok


Thank you !

jean-arthur

---

EuroVox
4, place Félix Eboue
75583 Paris Cedex 12
Tel : 01 44 67 05 05
Fax : 01 44 67 05 19
Web : http://www.eurovox.fr





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Time out for file()? - Use fsockopen

2001-11-14 Thread George Whiffen

Jean-Arthur,

Your set_time_limit/shutdown function solution looks like a clever
trick.  If you can come up with that you might just as well do the
proper job with an fsockopen and socket_set_timeout.

The manual pages on fsockopen, socket_set_timeout plus the user comments
have plenty of useful examples:

http://www.php.net/manual/en/function.fsockopen.php
http://www.php.net/manual/en/function.socket-set-timeout.php

You might also want to look at socket_set_blocking as an alternative.
(Switch to non-blocking so that your gets always returns immediately
and then you can put in your own wait/action before trying another gets).
Check out: 

http://www.php.net/manual/en/function.socket-set-blocking.php

Either way, to write your own jasfile() to emulate file() shouldn't be more than 
10-20 lines.

An extra advantage of using fsockopen is that you can send a HEAD request
before your GET/POST to check the server/page are there.  If that
works you can then give the target server longer to serve the GET in
case the problem is just slow communications rather than a missing/slow
server.


Good Luck

George


Jean-Arthur Silve wrote:
 
 Hi !
 
 I use the file function for accessing to pages on another server.
 
 It works perfectly.
 
 But if the server does not respond or is too long to send datas, the file
 function wait too long..
 
 Is there a way to tune the time out ?? I would like that id the server does
 not respond, the function return in few seconds only.
 
 I thought to a solution using :
 
 set_time_limit(2);
 register_shutdown_function(func);
 file(myurl);
 set_time_limit(30);
 func();
 
 In this example if the file function takes more than 2 seconds, then func()
 would be called. If the file function does not time out, then then func is
 called too...
 
 But may be there is a cleanest way to do this (I checked the manual,
 somethink like socket_set_timeout), in the way that if the time function
 timed out then the script continues normally, returning an error:
 
 tuning the time out(2);
 $f=file(myurl);
 if ($f==false)
  // Timed out
 else
  // ok
 
 
 Thank you !
 
 jean-arthur
 
 ---
 
 EuroVox
 4, place Félix Eboue
 75583 Paris Cedex 12
 Tel : 01 44 67 05 05
 Fax : 01 44 67 05 19
 Web : http://www.eurovox.fr
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: time limt

2001-10-02 Thread Richard Lynch

file() won't let you set the time-out...

But http://php.net/fopen will.


--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Roel [EMAIL PROTECTED]
Newsgroups: php.general,php.windows,php.dev
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Sunday, September 30, 2001 2:12 PM
Subject: time limt


 Hi,

 set_time_limit() and max_execution_time() wont work on this script.

 $url  = http://www.example.com;
 $file = implode('',file($url));
 if(!$file)
  {
   print(error);
  }

 My question is how can I make the script time out if the server where I
want
 to connect to is busy. Now the script will time out after 30 (default)
 seconds. I want to connect, if the server is busy then a message server
 busy should appear but not after 30 seconds!

 I'm not working local so I can't change the default 30 sec.

 Thanks very much!
 Roel




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: time

2001-08-22 Thread Raphael Pirker

convert both to a timestamp... check
http://www.php.net/manual/en/function.mktime.php for more info



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Time Taken to Process

2001-07-16 Thread Philip Hallstrom

Look at the recent subject entitled echo vs printf.  There's code to do
exactly what you want.  I don't think there's anything built in, but I
could be wrong.

On Mon, 16 Jul 2001, Phil Spitler wrote:

 Does anyone know an easy way to tell how long a page takes to run in ms.
 Maybe some variable that can be called at the bottom of the page or
 something.

 THANKS!

 -
 Phil Spitler [Applications Developer]
 American City Business Journals
 p: 704.973.1049
 f: 704.973.8049
 e: mailto:[EMAIL PROTECTED]


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] RE: Time Taken to Process

2001-07-16 Thread Phil Spitler

yeah, I just saw that, thanks! :)

Phil

 -Original Message-
 From: Philip Hallstrom [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 16, 2001 2:12 PM
 To: Phil Spitler
 Cc: [EMAIL PROTECTED]
 Subject: Re: Time Taken to Process


 Look at the recent subject entitled echo vs printf.  There's code to do
 exactly what you want.  I don't think there's anything built in, but I
 could be wrong.

 On Mon, 16 Jul 2001, Phil Spitler wrote:

  Does anyone know an easy way to tell how long a page takes to run in ms.
  Maybe some variable that can be called at the bottom of the page or
  something.
 
  THANKS!
 
  -
  Phil Spitler [Applications Developer]
  American City Business Journals
  p: 704.973.1049
  f: 704.973.8049
  e: mailto:[EMAIL PROTECTED]
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] RE: Time Taken to Process

2001-07-16 Thread Michael Geier, CDM Systems Admin

try the attached class.

$t = new timer;
$t-start();
// some code;
$t-stop();

$diff = $t-gettime();
echo $diff;

-Original Message-
From: Phil Spitler [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 16, 2001 1:20 PM
To: [EMAIL PROTECTED]
Subject: [PHP] RE: Time Taken to Process


yeah, I just saw that, thanks! :)

Phil

 -Original Message-
 From: Philip Hallstrom [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 16, 2001 2:12 PM
 To: Phil Spitler
 Cc: [EMAIL PROTECTED]
 Subject: Re: Time Taken to Process


 Look at the recent subject entitled echo vs printf.  There's code to do
 exactly what you want.  I don't think there's anything built in, but I
 could be wrong.

 On Mon, 16 Jul 2001, Phil Spitler wrote:

  Does anyone know an easy way to tell how long a page takes to run in ms.
  Maybe some variable that can be called at the bottom of the page or
  something.
 
  THANKS!
 
  -
  Phil Spitler [Applications Developer]
  American City Business Journals
  p: 704.973.1049
  f: 704.973.8049
  e: mailto:[EMAIL PROTECTED]
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


[PHP] Re: time compare in my sql

2001-07-12 Thread elias

try this:
select * from table where TIME(time_field)  = 12

Jack [EMAIL PROTECTED] wrote in message
060101c10b0d$cd941940$[EMAIL PROTECTED]">news:060101c10b0d$cd941940$[EMAIL PROTECTED]...
Hi folks
I have a filed in data type time , how would I compare the value submited
from the form with the value in that filed, which is in format 11:00:00 ?
When I do this in query:

select * from table where time  = '12:00:00'; ( in order select all records
that have time before noon)

it keeps saying sql syntax error.

What should I do?
Jack
[EMAIL PROTECTED]
Love your enemies, it will drive them nuts




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] re: time

2001-06-22 Thread [EMAIL PROTECTED]

Dear Jason
got problem that make me not able to email direct to the list, they keep
bounce me back. Anyway, apologise in advance that I have to email you
directly, I used PHP_AUTH_USER for login method, no cookies or session used,
how could I do the logout that will completely get rid of the log in details
without having user to close the browser?
Jack
[EMAIL PROTECTED]
Love your enemies, it will drive them nuts
- Original Message -
From: Jason Murray [EMAIL PROTECTED]
To: 'Jon Yaggie' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, June 20, 2001 11:52 PM
Subject: RE: [PHP] re: time


  actually i believe if you date() it gives you users system time
 
  it is the problem i have run into in the script i am trying to
  modify. the original person used date() and it clear shows my time.
  As much as i admit the possibility of their server being in Siberia
  but I doubt it.

 PHP would have no idea what the time is on the user's system.

 Date() returns the current system time in the format you specify.

 Of course, if the time on their system is stuffed, it could look
 like they're in Siberia...

 Jason

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] re: time

2001-06-21 Thread Jason Murray

 actually i believe if you date() it gives you users system time
 
 it is the problem i have run into in the script i am trying to 
 modify. the original person used date() and it clear shows my time. 
 As much as i admit the possibility of their server being in Siberia 
 but I doubt it. 

PHP would have no idea what the time is on the user's system.

Date() returns the current system time in the format you specify.

Of course, if the time on their system is stuffed, it could look 
like they're in Siberia...

Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] re: time

2001-06-20 Thread Jon Yaggie



actually i believe if you date() it gives you users 
system time

it is the problem i have run into in the script i 
am trying to modify. the original person used date() and it clear shows my 
time. As much as i admit the possibility of their server being in Siberia 
but I doubt it. 


Thank You,Jon Yaggiewww.design-monster.comAnd 
they were singing . . . '100 little bugs in the code100 bugs 
in the codefix one bug, compile it again101 little bugs in the 
code101 little bugs in the code . . .'And it 
continued until they reached 0