Hi I've spent a lot of time searching so I hope this isn't a redundant yank question. I know there was a "bug fix" that added American English as a language, but my helpdesk wants me to configure their OTRS 2.3.3 with a 12 hour clock in LongDateFormat, DateFormat, etc.
It looks like en.pm uses MySQL date format syntax, and as such I should be able to replace %T with %r for 12 hour time, but no such luck. In fact most of the standard MySQL/Perl/POSIX time format tricks don't work. Is there any way to get a 12 hour clock despite its inferiority in every way?
Thanks
BB
Date format spec?
Moderator: crythias
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Date format spec?
check and modify
Kernel/Language/[languagecode].pm (eg, Kernel/Language/en.pm
Kernel/Language/[languagecode].pm (eg, Kernel/Language/en.pm
Code: Select all
# date formats (%A=WeekDay;%B=LongMonth;%T=Time;%D=Day;%M=Month;%Y=Year;)
$Self->{DateFormat} = '%M/%D/%Y %T';
$Self->{DateFormatLong} = '%T - %M/%D/%Y';
$Self->{DateFormatShort} = '%M/%D/%Y';
$Self->{DateInputFormat} = '%M/%D/%Y';
$Self->{DateInputFormatLong} = '%M/%D/%Y - %T';
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Date format spec?
Thanks for the reply. So there is no 12 hour clock supported by the spec? I don't suppose you know if dates are generated by the application or by the database? I tried to chase through the code and find it, but got lost. Will try again.
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Date format spec?
I based my post on the assumption that you already had an idea what format you'd like to use, and you'd merely change the formats that exist to the ones you want. For those following: POSIX strftime codes.
Change %T to %r
Change %T to %r
%r is replaced by the time in a.m. and p.m. notation; in the POSIX locale this is equivalent to %I:%M:%S %p.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Date format spec?
Yes as per the first post I've tried that, but the %r passes through unreplaced. I guess I'll have to dig into the code more myself and make some changes.
Thanks
Thanks
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Date format spec?
ack. please forgive me. You did say that and I don't know why I duplicated.
I really really thought Language.pm would be the answer, and it might have been, but alas, not to be.
The System/Time.pm yields not many clues, either, because it's using perl localtime, which only provides for hour in 24 hour format.
Here's my Language.pm option, which I admit isn't pretty but does appear to work:
I really really thought Language.pm would be the answer, and it might have been, but alas, not to be.
The System/Time.pm yields not many clues, either, because it's using perl localtime, which only provides for hour in 24 hour format.
Here's my Language.pm option, which I admit isn't pretty but does appear to work:
Code: Select all
my $thour = substr($T, 0, 2);
my $tap = "am";
if ($thour > 12) {
$thour -= 12;
$tap = "pm";
}
my $test = substr($T, 0, 2, $thour);
if ($Short) {
$T =~ s/(\d\d:\d\d):\d\d/$1/g;
}
$T = $T . $tap;
$ReturnString =~ s/\%T/$T/g;
$ReturnString =~ s/\%D/$D/g;
$ReturnString =~ s/\%M/$M/g;
$ReturnString =~ s/\%Y/$Y/g;
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask