I would like to change the date format

drmarty wrote on Wednesday, June 09, 2010:

I have set up a web server and loaded OpenEMR version 3.2.0. I then was able to set up the ICD9 lookup. Whew! I now am at the stage of beginning to customize my installation. So the first thing I would like to change in the date format from YYYY-MM-DD which I believe is European (maybe not, who cares) to what I am used to which is MM-DD-YYYY. I assume learning to do that will also teach me the method for other changes. Or at least I hope so.

drmarty

sunsetsystems wrote on Wednesday, June 09, 2010:

For data entry, dates in mm/dd/yyyy or mm-dd-yyyy format are already recognized.

For display purposes, there has been some work done in the 4.0 branch to display dates in alternate formats.

Rod
www.sunsetsystems.com

stephen-smith wrote on Wednesday, June 09, 2010:

YYYY-MM-DD is the international standard.  It should be acceptable to anyone doing business in an ISO member nation.  It also collates (sorts) well.

drmarty wrote on Wednesday, June 09, 2010:

Stepehn-smith: thanks. What you say is all true. I was asked to change it by my partner. I feel customization includes being able to change the program. Sure I could tell him the program wants to customize him, but I have sung the praise of OpenEMR because we can customize it to suit our needs, rather than have to change to fit it. We have had that experience before.
I guess the question I was asking is not should we do it but can we and how do we do it? As I mentioned I felt it would be a sort of tutorial for me for other items. But not to worry. I will have many other things to “act as a tutorial” HaHa.
As Rod points out the system now recognizes both inputs which is nice to know (thanks Rod)
A small systemic point. Should I be asking these questions in Help?

Again thanks for taking the time to answer.

drmarty

stephen-smith wrote on Wednesday, June 09, 2010:

As Rod mentioned, there are some changes in the 4.0 branch to try and display dates in other formats, but I don’t know the exact patches off the top of my head, and I don’t know who is organizing / making those changes.

I certainly support this as part of the i18n/l10n effort.  Perhaps it would be appropriate to have a specific constant (e.g. “DATE_STRFTIME_FORMAT”) that is stored in the same table as the translations as used any time we need to display a date.

I’m guessing you should look for new calls to strftime in the diff between your revision (rel-320?) and HEAD to see how this is currently being done in the 4.0 line.

drmarty wrote on Wednesday, June 09, 2010:

Thanks again for the reply. It shows how much learning I have to do (which I knew) but gives me a direction (which I hoped for.)

I shall plug ahead.

drmarty

blankev wrote on Sunday, August 17, 2014:

In

sites/default/statements.inc.php

the date is presented as YYYY/mm/dd, i want ot change it into dd/mm/YYYY, the following did not work: in about line 30 I include the following:

$STMT_TEMP_FILE = $GLOBALS[‘temporary_files_dir’] . “/openemr_statements.txt”;
$STMT_TEMP_FILE_PDF = $GLOBALS[‘temporary_files_dir’] . “/openemr_statements.pdf”;

$STMT_PRINT_CMD = $GLOBALS[‘print_command’];

// New Included:

date_format($date, ‘d/m/Y’);

// This function builds a printable statement or collection letter from
// an associative array having the following keys:
//
// today = statement date yyyy-mm-dd

// Each detail array is keyed on a string beginning with a date in
// yyyy-mm-dd format, or blanks in the case of the original charge
// items. Its values are associative arrays like this:
//

Any help welcome… I am reading, learning but not without some help obvious,

tnx in advance

teryhill wrote on Monday, August 18, 2014:

Ok here you go
Add this line about 138

138 $tmpdate=substr($stmt[‘today’] ,5,2) . “-” . substr($stmt[‘today’] ,8,2) . “-” . substr($stmt[‘today’] ,2,2);

change this line it is about line 169

169 $out = sprintf("%-30s %-23s %-s\n",$clinic_name,$stmt[‘patient’],$tmpdate);

add this line
234 $tmpdos=substr($dos ,5,2) . “-” . substr($dos,8,2) . “-” . substr($dos ,2,2);

change this line it is about line 235

235 $out .= sprintf("%-10s %-45s%8s\n", $tmpdos, $desc, $amount);

and change this line 257

256 $out .= sprintf("%-s: %-25s %-s: %-14s %-s:%8s\n",$label_ptname,$stmt[‘patient’],
257 $label_today,$tmpdate,$label_due,$stmt[‘amount’]);

Terry

blankev wrote on Monday, August 18, 2014:

Terry I made some changes. I want to thank you and also mention your name in the intro of the file as good adviser.

What do you want to be named: Terry? Terry Hill?? something else?

If I manage to get things going, I am going to place this in Github for inclusion of next patch/release.

teryhill wrote on Monday, August 18, 2014:

Ahh my name in lights… Terry Hill is fine. 8^)

blankev wrote on Wednesday, August 20, 2014:

Terry,

Just above solution worked great for one file. So my problem is solved. Now I find the following in /…/library/date_functions.php

============================================================================

// Date string format
// First, get current language title
$languageTitle = getLanguageTitle($_SESSION[‘language_choice’]);
switch ($languageTitle) {
// standard english first
case getLanguageTitle(1):
$dt = date (“F j, Y”, $strtime);
if ($with_dow) $dt = “$dow, $dt”;
break;
case “Swedish”:
$dt = date (“Y”, $strtime) . " $nom " . date(“d”, $strtime);
if ($with_dow) $dt = “$dow $dt”;
break;
case “Spanish”:
$dt = date (“d”, $strtime) . " $nom " . date(“Y”, $strtime);
if ($with_dow) $dt = “$dow $dt”;
break;
case “German”:
$dt = date (“d”, $strtime) . " $nom " . date(“Y”, $strtime);
if ($with_dow) $dt = “$dow $dt”;
break;
case “Dutch”:
$dt = date (“d”, $strtime) . " $nom " . date(“Y”, $strtime);
if ($with_dow) $dt = “$dow $dt”;
break;
// hebrew (israel) , display english NOT jewish calendar
case “Hebrew”:
$dt = date (“F jS Y”, $strtime);
if ($with_dow) $dt = “$dow, $dt”;
break;
// default case
default:
$dt = "$nom " . date (“d”, $strtime) . ", " . date(“Y”, $strtime);
if ($with_dow) $dt = “$dow, $dt”;
}

return $dt;

====================================================================================

To me this looks like a more general appoach for the Internationalisation of dates. Can you guide me how I could include this date translation available in OpenEMR for the International date setting for the individual file? Is it just a matter changing $dt into $today? Something like in the first option of a file I include above and change above where $dt change it into Stoday? or $DOB? Am I in the direction or is this just a remark odd enough to be rejected?