This topic is locked

Trouble with Time in DatePicker

1/29/2007 3:21:45 PM
PHPRunner General questions
C
comlan author

I am having trouble with the TIME portion of the datepicker when it is used from

12:00:00 pm (12:00:00 24-hour clock) until 1:00:00 pm (13:00:00 24-hour clock).
When the datepicker with the show time in datepicker option is used, any records added during this time are stored as AM.
Using the Default Value Now() option produces the same problem.
This is only a problem during this hour from noon until 1 pm.
Any ideas on getting the time to save correctly as PM during this hour?
Thanks.

Alexey admin 1/30/2007

Hi,
thank you for pointing me to this bug.

We'll fix it with the next update of PHPRunner.
To get your pages working now please modify locale.php file in C:\Program Files\PHPRunner3.1\source folder
Find this snippet there:

$use12=0;

$pos=strpos($locale_info["LOCALE_STIMEFORMAT"],"h".$locale_info["LOCALE_STIME"]);

if(!($pos===false))

{

$use12=1;

// determine am/pm

$pm=0;

$amstr=$locale_info["LOCALE_S1159"];

$pmstr=$locale_info["LOCALE_S2359"];

if(strlen($amstr)>strlen($pmstr))

{

$pos=strpos($strtime,$amstr);

if($pos===false && $pmstr && !( ($pos=strpos($strtime,$pmstr)) ===false))

$pm=1;

}

else if($pmstr && !(($pos=strpos($strtime,$pmstr))===false))

$pm=1;

}

and replace it with:

$use12=0;

$pos=strpos($locale_info["LOCALE_STIMEFORMAT"],"h".$locale_info["LOCALE_STIME"]);

if(!($pos===false))

{

$use12=1;

// determine am/pm

$pm=0;

$amstr=$locale_info["LOCALE_S1159"];

$pmstr=$locale_info["LOCALE_S2359"];

$posam=strpos($strdatetime,$amstr);

$pospm=strpos($strdatetime,$pmstr);

if($posam===false && $pospm!==false)

$pm=1;

elseif($posam!==false && $pospm===false)

$pm=0;

elseif($posam===false && $pospm===false)

$use12=0;

else

{

if($posam>$pospm)

$pm=1;

}

}



There are two occurencies of this code there so two replacements are needed.

C
comlan author 1/30/2007

Hi,

thank you for pointing me to this bug.

We'll fix it with the next update of PHPRunner.
To get your pages working now please modify locale.php file in C:\Program Files\PHPRunner3.1\source folder
Find this snippet there:

$use12=0;

$pos=strpos($locale_info["LOCALE_STIMEFORMAT"],"h".$locale_info["LOCALE_STIME"]);

if(!($pos===false))

{

$use12=1;

// determine am/pm

$pm=0;

$amstr=$locale_info["LOCALE_S1159"];

$pmstr=$locale_info["LOCALE_S2359"];

if(strlen($amstr)>strlen($pmstr))

{

$pos=strpos($strtime,$amstr);

if($pos===false && $pmstr && !( ($pos=strpos($strtime,$pmstr)) ===false))

$pm=1;

}

else if($pmstr && !(($pos=strpos($strtime,$pmstr))===false))

$pm=1;

}

and replace it with:

$use12=0;

$pos=strpos($locale_info["LOCALE_STIMEFORMAT"],"h".$locale_info["LOCALE_STIME"]);

if(!($pos===false))

{

$use12=1;

// determine am/pm

$pm=0;

$amstr=$locale_info["LOCALE_S1159"];

$pmstr=$locale_info["LOCALE_S2359"];

$posam=strpos($strdatetime,$amstr);

$pospm=strpos($strdatetime,$pmstr);

if($posam===false && $pospm!==false)

$pm=1;

elseif($posam!==false && $pospm===false)

$pm=0;

elseif($posam===false && $pospm===false)

$use12=0;

else

{

if($posam>$pospm)

$pm=1;

}

}



There are two occurencies of this code there so two replacements are needed.

C
comlan author 1/30/2007

Thank you for the reply.
I made the changes as you suggested. When trying to add a record I got an error something like "unknown variable strtime".
In looking things over, I changed the strtime instances to strdatetime.
This allowed me to add a record, but I still have the previously reported am/pm issue from 12:00:00 thru 12:59:59.
My "locale.php" file was located in \Program Files\PHPRunner3.1\Source\Include. I did also include a copy "locale.php" to \Program Files\PHPRunner3.1\Source.
I am using Build 207. Perhaps you could send me a working copy of "locale.php" that you have tested. Or, I am willing to try another solution as recommended by you.
Thanks

Alexey admin 1/31/2007

Hi,
please download this file:

http://www.asprunner.com/files/locale.zip
then unzip it to :

C:\Program Files\PHPRunner3.1\source\include
This file works with PHPRunner 3.1 build 207.

C
comlan author 2/2/2007

The "locale.php" update fixed the problem.
Thanks for your help.