You should be aware that your have multiple gmtime() function calls in your 
script and this could cause problem. the reason is because between your 
first and second gmtime() function call, some times have passed(yes, very 
very very little but...) so the time return by the 2 gmtime() functions 
call is NOT identical. So it's possible that if  you run the script in 
midnight, the next gmtime() might return the time for the next day! what 
you want is have one gmtime() function call and capture the result like:

($min,$hour,$day,$month,$year,$wday) = (gmtime)[1..6];

and then work on the individaul part...

david

A Taylor wrote:

> Hi all,
> Thanks for your help so far - I have managed to sort out my time and date
> problem but there are a few points that I dont understand.
> The code I have used is as follows:
> 
> # get the hours, mins, weekday, day, month  and year
> $hour  = (gmtime)[2];
> $min   = (gmtime)[1];
> $wday  = (qw(Sun Mon Tue Wed Thu Fri Sat)) [(gmtime) [6]];
> $day   = (gmtime)[3];
> $month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) [(gmtime)
> [4]];
> $year  = (gmtime)[5] + 1900;
> 
> # test the length of $min - if length = 1 then add a '0' at the begining.
> 
> $minlen = length $min;
> if ($minlen < 2)
> {
> $min = "0".$min;
> }
> $hour ++;
> 
> I have had to do a test to see if the $min var is 1 or 2 in length:
> 
> $minlen = length $min;
> if ($minlen < 2)
> {
> $min = "0".$min;
> }
> 
> this is because 22:07 (for example) would otherwise come out as 22:7 -
> which is a bit confusing. Is there a better way to do this ????
> 
> Also I have had to add 1 to the hour var: $hour ++; even though my web
> space providers are in the same country as me - does anyone know why this
> is - I am probably being a bit daft - well it is 1am, and I have been
> perling for about 16 hours now !!! Gulp ^_^
> 
> Thanks for any help
> Anadi
> 
> 
> You are just a dewdrop, and as you meditate the dewdrop starts slipping
> from the petals of the Lotus towards the ocean. When the meditation is
> complete, the dewdrop has disappeared into the ocean. Or you can say, the
> ocean has disappeared into the dewdrop.
> 
> Bhagwan Shree Rajneesh.
> 
> 
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to