Show time in 12 hour (AM/PM) format

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
lewisg
Posts: 3
Joined: Tue Nov 15, 2016 5:33 pm

Show time in 12 hour (AM/PM) format

Post by lewisg »

As the subject title says, I'm wishing to display the time in a 12 hour (AM/PM) format.....can it be done?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Show time in 12 hour (AM/PM) format

Post by dwhitfield »

From https://assets.nagios.com/downloads/nag ... gmain.html
Format: date_format=<option>
Example: date_format=us

This option allows you to specify what kind of date/time format Nagios should use in the web interface and date/time macros.
In case that doesn't work for you, what version of Core are you using? Did you install it from repos or compile from source? On what OS/version are you running Core? This last question will help us figure out how date's are being processed on your system.

If that does work for you, is it ok if we go ahead and lock the thread?
lewisg
Posts: 3
Joined: Tue Nov 15, 2016 5:33 pm

Re: Show time in 12 hour (AM/PM) format

Post by lewisg »

dwhitfield wrote:From https://assets.nagios.com/downloads/nag ... gmain.html
Format: date_format=<option>
Example: date_format=us

This option allows you to specify what kind of date/time format Nagios should use in the web interface and date/time macros.
In case that doesn't work for you, what version of Core are you using? Did you install it from repos or compile from source? On what OS/version are you running Core? This last question will help us figure out how date's are being processed on your system.

If that does work for you, is it ok if we go ahead and lock the thread?
Yeah, had that set already to date_format=us

The system is:
Nagios Core 4.21 ...... compiled from source.
Operating System: CentOS Linux 7 (Core) minimal
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64

Checking Google I received no joy.
Tried a few changes in php.ini and Apache's config files (SSI directives in particular) without success.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Show time in 12 hour (AM/PM) format

Post by dwhitfield »

So, unfortunately, it looks like the answer is..."not easily."

The date format code is as follows:

Code: Select all

else if(!strcmp(variable, "date_format")) {

			if(!strcmp(value, "euro"))
				date_format = DATE_FORMAT_EURO;
			else if(!strcmp(value, "iso8601"))
				date_format = DATE_FORMAT_ISO8601;
			else if(!strcmp(value, "strict-iso8601"))
				date_format = DATE_FORMAT_STRICT_ISO8601;
			else
				date_format = DATE_FORMAT_US;
}
from https://github.com/NagiosEnterprises/na ... fig.c#L994

If you don't want to modify the code yourself, you can post a feature request at https://github.com/NagiosEnterprises/na ... issues/new

Is it ok if we go ahead and lock this up? The github feature request is a better place for people to explain why they want the feature than the forum post.
lewisg
Posts: 3
Joined: Tue Nov 15, 2016 5:33 pm

Re: Show time in 12 hour (AM/PM) format

Post by lewisg »

Thanks, I'll play with changing the code in a sandbox install and also put in a feature request on github.
Closing thread.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Show time in 12 hour (AM/PM) format

Post by dwhitfield »

If you do come up with a fix, definitely post it on github, or just open a new thread. I'm really shocked this hasn't been a request in the past. You can't be the only person that prefers or has users that prefer AM/PM.
Locked