OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Date display

Are you an Editor, Author, or Journal Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael, vgabler, John

Forum rules
This forum is meant for general questions about the usability of OJS from an everyday user's perspective: journal managers, authors, and editors are welcome to post questions here, as are librarians and other support staff. We welcome general questions about the role of OJS and how the workflow works, as well as specific function- or user-related questions.

What to do if you have general, workflow or usability questions about OJS:

1. Read the documentation. We've written documentation to cover from OJS basics to system administration and code development, and we encourage you to read it.

2. take a look at the tutorials. We will continue to add tutorials covering OJS basics as time goes on.

3. Post a question. Questions are always welcome here, but if it's a technical question you should probably post to the OJS Technical Support subforum; if you have a development question, try the OJS Development subforum.

Date display

Postby ramon » Fri Oct 17, 2003 12:44 pm

Our date display is dd/mm/yyyy (and variations of it...)

if we change the current display (yyyy-mm-dd), will that affect the system in anyway?

Have you planned for a date display customization in the system?
ramon
 
Posts: 926
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Postby kevin » Sun Oct 19, 2003 5:05 pm

Changing the date display should not affect the system.

This will likely be customizable in a future version.
kevin
 
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm

date function

Postby ramon » Mon Mar 22, 2004 12:42 pm

dear fellows,
here´s a function for date display in many languages (each language has to be added... it has english and protuguese)
The languages should be in the language files, but they use the define parameters instead of regular array definitions.

I hope you can improve this to add functionality to OJS
PS: the html is only for testing output...
the function receives a set of parameters, that define the language and the format desired.
I believe they are self explanatory...

Code: Select all
<?php
/**
Ramón Fonseca
Desenvolvimento Web
IBICT - Instituto Brasileiro de Informação em Ciência e Tecnologia

+55 61 217 6443
+55 61 357 0018
+55 61 3032 7121

ramonsodoma@hotmail.com
ramon@ibict.br
**/
//funcao dataConv($idioma, $var, $dataform)
/* imprime data em varios idiomas (implementados: PT, EN)
$idioma => idioma da data (PT, EN, etc...)
$var => valor/variavel a ser tratada (caso seja vazia trata data do servidor), geralmente tratada com strtotime()
$dataform => array com os seguintes itens, cada um representando o seguinte:
- ano:  $dataform[0] => 0(sem ano), 1(4 digitos), 2 (2 digitos)
- mes:  $dataform[1] => 0(sem mes), 1(extenso), 2(3 letras), 3(1 a 12), 4(01 a 12), 5(1 letra)
- ddia : $dataform[2] => 0(sem data), 1(01 a 31), 2(1 31)
- dia:  $dataform[2] => 0(sem dia), 1(extenso), 2(3 letras), 3(1 letra)
- hora: $dataform[3] => 0(sem hora), 1(1 a 12), 2(01 a 12), 3(0 a 23), 4(00 a 23)
- min:  $dataform[4] => 0(sem min), 1(00 a 59)
- seg:  $dataform[5] => 0(sem seg), 1(00 a 59)
- ext:  $dataform[6] => 0(sem am/pm), 1 (am/pm), 2(AM/PM)
- separador : $dataform[8] => ", ", "/"
*/

function dataConv($idioma, $var, $dataform){
$erro = "<br>erro inesperado, no módulo desconhecido!<br>"; //mensagem p/ testes negativos
$sucesso = "<br>beleza...cheguei aqui!<br>";//mensagem p/ testes positivos
//arrays de dias - colocar em arquivo externo
$dias["PT"]=array("Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-Feira","Sexta-feira","Sábado");
$dias["EN"]=array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
//arrays de meses - colocar em arquivo externo
$meses["PT"]=array("","Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro");
$meses["EN"]=array("","January","February","March","April","May","June","July","August","September","October","November","December");

//elementos de data
$ano=array("",date("Y",$var), date("y",$var));
$mes=array("",$meses[$idioma][date("n",$var)],substr($meses[$idioma][date("n",$var)],0,3),substr($meses[$idioma][date("n",$var)],0,1),date("n",$var),date("m",$var));
$ddia=array("",date("d",$var),date("j",$var));
$dia=array(" ",$dias[$idioma][date("w",$var)],substr($dias[$idioma][date("w",$var)],0,3),substr($dias[$idioma][date("n", $var)],0,1));
$hora=array("",date(" g",$var),date(" h",$var),date(" G",$var),date(" H",$var));
$min=array("",date(":i",$var));
$sec=array("",date(":s",$var));
$ext=array("",date(" - a",$var),date(" - A",$var));

   if (!$idioma && !$dataform){
   echo $erro;
   }else{
   switch($idioma){
      case "PT":
         switch($dataform[8]){
            case ", ":
            echo $dataFinal=$dia[$dataform[3]].$dataform[8].$ddia[$dataform[2]]." ".$mes[$dataform[1]]." de ".$ano[$dataform[0]].$hora[$dataform[4]].$min[$dataform[5]].$sec[$dataform[6]].$ext[$dataform[7]];
            break;
            
            case "/":
            echo $dataFinal=$dia[$dataform[3]].", ".$ddia[$dataform[2]].$dataform[8].$mes[$dataform[1]].$dataform[8].$ano[$dataform[0]].$hora[$dataform[4]].$min[$dataform[5]].$sec[$dataform[6]].$ext[$dataform[7]];
            break;
         }
      break;
      
      case "EN":
         switch($dataform[8]){
            case ", ":
            echo $dataFinal=$dia[$dataform[3]].$dataform[8]." ".$mes[$dataform[1]]." ".$ddia[$dataform[2]]." ".$ano[$dataform[0]].$hora[$dataform[4]].$min[$dataform[5]].$sec[$dataform[6]].$ext[$dataform[7]];
            break;
            
            case "/":
            echo $dataFinal=$dia[$dataform[3]].", ".$mes[$dataform[1]].$dataform[8].$ddia[$dataform[2]].$dataform[8].$ano[$dataform[0]].$hora[$dataform[4]].$min[$dataform[5]].$sec[$dataform[6]].$ext[$dataform[7]];
            break;
         }
      break;
      }
   }
}
?>
<html></html>
<head>
<title>Teste PHP Data</title>
<link href="../ojs/include/journal.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="10" leftmargin="10">
<h3> Testando Fun&ccedil;&atilde;o Conversor de Data! </h3>
<h4> Fun&ccedil;&atilde;on dataConv($idioma, $var, $dataform)</h4>
<span class="errormsg">Par&acirc;metros:</span><br>
<code>
- ano : $dataform[0] => 0(sem ano), 1(4 digitos), 2 (2 digitos) <br>
- mes : $dataform[1] => 0(sem mes), 1(extenso), 2(3 letras), 3(1 a 12), 4(01 a 12), 5(1 letra)<br>
- ddia : $dataform[2] => 0(sem data), 1(01 a 31), 2(1 31)<br>
- dia : $dataform[3] => 0(sem dia), 1(extenso), 2(3 letras), 3(1 letra)<br>
- hora: $dataform[4] => 0(sem hora), 1(1 a 12), 2(01 a 12), 3(0 a 23), 4(00 a 23)<br>
- min : $dataform[5] => 0(sem min), 1(00 a 59)<br>
- seg : $dataform[6] => 0(sem seg), 1(00 a 59)<br>
- ext : $dataform[7] => 0(sem am/pm), 1 (am/pm), 2(AM/PM)<br>
- separador : $dataform[8] => ", ", "/"<br>   
</code>
<br>
<span class="errormsg">data de atualiza&ccedil;&atilde;o:</span> <code>
<? $dataAtual="2004-02-06 18:16"; echo date("l, m/d/Y - H:i:s A",strtotime($dataAtual)); ?>
</code><br>
<br>
<?
$idioma="PT";
$var="2004-02-06 14:30:20";
echo "</p>".date("l, m/d/Y - H:i:s A",strtotime($var))."</p><br>";
/*
- ano:  $dataform[0] => 0(sem ano), 1(4 digitos), 2 (2 digitos)
- mes:  $dataform[1] => 0(sem mes), 1(extenso), 2(3 letras), 3(1 a 12), 4(01 a 12), 5(1 letra)
- ddia : $dataform[2] => 0(sem data), 1(01 a 31), 2(1 31)
- dia:  $dataform[2] => 0(sem dia), 1(extenso), 2(3 letras), 3(1 letra)
- hora: $dataform[3] => 0(sem hora), 1(1 a 12), 2(01 a 12), 3(0 a 23), 4(00 a 23)
- min:  $dataform[4] => 0(sem min), 1(00 a 59)
- seg:  $dataform[5] => 0(sem seg), 1(00 a 59)
- ext:  $dataform[6] => 0(sem am/pm), 1 (am/pm), 2(AM/PM)
- separador : $dataform[8] => ", ", "/"
*/
$dataform=array(1,2,1,2,1,1,1,2,", ");
dataConv($idioma, strtotime($var), $dataform);
?>
</body>
</html>
ramon
 
Posts: 926
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Postby kevin » Mon Mar 22, 2004 3:43 pm

We plan to use strftime for localized date display. Configuration variables for the short/long date formats used with strftime will be provided as well.
kevin
 
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm


Return to OJS Editorial Support and Discussion

Who is online

Users browsing this forum: No registered users and 5 guests