URL: http://www.uburst.com/cgi-bin/dcforum/dcboard.cgi
Forum: ushop_cgi
Thread Number: 117
[ Go back to previous page ]

Original Message
"CGI - the time on the recieved order is not danish time?"

Posted by Marianne Topping [Janne@topping.dk] on at 06:04 AM
I really need the recieved order to display the correct time ( Danish time ), as of now it's prob. usa time ;)

Table of contents

Messages in this discussion
"RE: CGI - the time on the recieved order is not danish time?"
Posted by Bill Weiner on at 02:52 PM
Are you referring to showing the date on the order form in the format:

DD/MM/YYYY

Instead of the US format:

MM/DD/YYYY?

If so, then here are some instructions one how to reformat the date on the order form:

STEP 1: Make a backup of the "ushop-lib.pl" file...just in case.

STEP 2: Open the "ushop-lib.pl" file with any text editor such as WordPad.

STEP 3: Do a search on the following line:

$order_date = sprintf("%02d/%02d/%02d",$mon+1,$mday,$year);

And change it to:

$order_date = sprintf("%02d/%02d/%02d",$mday,$mon+1,$year);

STEP 4: Do a search on the following line:

$date_string = sprintf("%02d/%02d/%04d : ",$mon+1,$mday,$year);

And change it to:

$date_string = sprintf("%02d/%02d/%04d : ",$mday,$mon+1,$year);

STEP 5: Save the file (as TEXT if your editor asks)...and try it out!

The date that appears on the order form and the order reader should now be in the format DD/MM/YYYY.

Note that we may eventually make that date format change ourselves to the Danish version (as we have already done to the German version)... but right now, for maintainability's sake, we keeping the date format consistent through all language versions.


"CGI - the time on the recieved order is not danish time?"
Posted by Marianne Topping [Marianne@topping.dk] on at 04:19 AM
Thanks for the help, but no, that is not what I meant.

I'm talking about the time, not the date. I need to recieved order to display Central European Time.


"RE: CGI - the time on the recieved order is not danish time?"
Posted by Bill Weiner on at 06:29 AM
Oh, I see. The date on the order form is currently based on the localtime of your server. We'll have to look into adding an easy way to adjust that based on whatever time zone you want (even if your server is located elsewhere). In the mean time, here are some instructions on change the date to be based on the Greenwich timezone.

STEP 1: Make a backup of your current ushop-lib.pl script ... just in case.

STEP 2: Open the ushop-lib.pl file with any text editor such as WordPad.

STEP 3: Do a search on the following line:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();

And change it to:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime();

STEP 4: Do a search on the following line:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($date_string);

And change it to:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($date_string);

STEP 5: Do a search on the following line:

$report .= " " . localtime() . "\n";

And change it to:

$report .= " " . gmtime() . "\n";

STEP 6: Save the file (as TEXT if your editor asks)... and try it out!

NOTE 1: The above changes with ensure that the date is based on "Greenwich" timezone on the order form, order reader, and diagnostic report. The date used internally by the "Coupon Manager" will still be based on the local time of your server... but that should not be a big deal.

NOTE 2: If you know how many seconds your time zone is ahead of the "Greenwich" timezone, then you may be able to adjust those lines in STEP 3, STEP 4, and STEP 5, by the corresponding number of seconds.

For example, if you know your time zone is 2 hours (7200 seconds) ahead of GMT time, then I think you could use these lines instead:

In Step 3:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time() + 7200);

In Step 4:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($date_string + 7200);

In Step 5:
$report .= " " . gmtime(time() + 7200) . "\n";