Date Format

esears1 wrote on Friday, December 02, 2005:

I would like to find out how I can change the way the date is displayed and entered into mysql.  Currently it is being displayed as 2005-12-2 and I would like it to be displayed as 12-02-2005.  Is something like this possible?


Edward

sunsetsystems wrote on Friday, December 02, 2005:

Most dates can already be entered in either yyyy-mm-dd or mm-dd-yyyy format, also you can use "/" instead of "-".

As far as changing the default display format, this would require some coding.  It should definitely be a user-selectable option.

– Rod
www.sunsetsystems.com

esears1 wrote on Thursday, December 08, 2005:

Hi Rod,

I am familar with PHP but I’m not familiar with the class files yet.  For example, I modified the prescription screen (data entry).  There were certain fields which the office doesn’t need.  Well, I found the class files that are associated and commented out two fields.  Now there are the getters and setter functions (i.e. get_interval, set_interval).  well, since I commented those out, there is another library which still has those functions in there which I cant find.  the main forms for prescription, they are commented out so I know they do not know about the function anymore.  My question is, what other file holds function information?

If I can get this question answered, then i’ll have a better idea on how to fix the date formatting.

Thanks.

Edward

sunsetsystems wrote on Friday, December 09, 2005:

I’m not sure offhand, I’d have to go hunting for them.  As far as data entry, there are some JavaScript modules in the library directory; see calendar.js and textformat.js.

– Rod
www.sunsetsystems.com

drbosman wrote on Friday, December 21, 2007:

Hi Rod and others,
For internationalisation reasons we really need to pick up on the date issue. My idea would be to generate a standard date (YYYY/MM/DD; MM/DD/YYYY; DD/MM/YYYY; / or -) based on country code. That will require creating a standard and changing all hard coded date appearances by a variable/function.

Michiel

andres_paglayan wrote on Friday, December 21, 2007:

standard should be database format or yyyymmdd
and then use a method to translate the date,
possibly using a global config variable
so hdate(yyyymmdd) will flip to output selection,
and if hdate() input is different from yyymmdd can flip to standard
(knowing the config variable)

lemonsoftwarero wrote on Saturday, December 22, 2007:

Hello everyone,

In the Dutch customized version of the OpenEMR, we’re using an auxiliary function, made to help us displaying these dates.
It’s called dateformat() and it can be found in library/date_functions.php. This function takes (or not) a string as arg and transform it, function of LANGUAGE constant, in a specific date string.

The function is in ‘beta’ state, it needs improvement but it’s a start.
Note: this function is only used to display dates; it doesn’t make the transformation interface -> database (and yes, as Andres said, the standard should be database format).