Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fix time on submit form? 1

Status
Not open for further replies.

brumer

Technical User
Feb 25, 2005
2
AU
Hi,
I have a form on my website hosted in America but I am in Australia.
When I recieve an email, it states time 16.5 hours slow (behind)
Can that be fixed? It is a Matt Wright script.
I found this in the script & thought it might save you looking.

sub get_date {

# Define arrays for the day of the week and month of the year. #
@days = ('Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday');
@months = ('January','February','March','April','May','June','July',
'August','September','October','November','December');

# Get the current time and format the hour, minutes and seconds. Add #
# 1900 to the year to get the full 4 digit year. #
($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
$time = sprintf("%02d:%02d:%02d",$hour,$min,$sec);
$year += 1900;

# Format the date. #
$date = "$days[$wday], $months[$mon] $mday, $year at $time";

}

Alterations to code ideas welcome.
TIA........

Brumer......
 
It's OK, Recieved help from perlboy at & this is fix.......

# 1900 to the year to get the full 4 digit year. #
$stutime = time;
$stutime = $stutime + 59400;
($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime($stutime))[0,1,2,3,4,5,6];

(compare to original message)

Thanks..... Brumer
 
Hey,

I used this alteration, thanks Brumer, just a clarification to anybody who reads this, 59400 is 16.5hr is seconds, so time is moved ahead 59400sec.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top