Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/10/2012, 11:23
disguiseddevil
 
Fecha de Ingreso: febrero-2011
Mensajes: 179
Antigüedad: 13 años, 2 meses
Puntos: 1
Cambiar hora de la BD

Hola, antes de preguntar he leido varias soluciones para cambiar la hora de la BD, pero ninguna me funciona o no lo hago bien.. no sé.

El caso es que tengo una web de preguntas tipo tests. La gente hace el test y le dice Test realizado el dia tal a la hora tal.. Pero la hora que marca son 6 horas menos de la que tenemos en España.

Pienso que se debe a donde esta alojado. No sé si cambiando alguna parte de este código lo solucionaria.
Código PHP:
<?php
/**
 * Smarty shared plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Function: smarty_make_timestamp<br>
 * Purpose:  used by other smarty functions to make a timestamp
 *           from a string.
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param string
 * @return string
 */
function smarty_make_timestamp($string)
{
    if(empty(
$string)) {
        
// use "now":
        
$time time();

    } elseif (
preg_match('/^\d{14}$/'$string)) {
        
// it is mysql timestamp format of YYYYMMDDHHMMSS?            
        
$time mktime(substr($string82),substr($string102),substr($string122),
                       
substr($string42),substr($string62),substr($string04));
        
    } elseif (
is_numeric($string)) {
        
// it is a numeric string, we handle it as timestamp
        
$time = (int)$string;
        
    } else {
        
// strtotime should handle it
        
$time strtotime($string);
        if (
$time == -|| $time === false) {
            
// strtotime() was not able to parse $string, use "now":
            
$time time();
        }
    }
    return 
$time;

}

/* vim: set expandtab: */

?>

o quizás de este otro:
Código PHP:
$lngstr['language']['date_only_format'] = '%m/%d/%Y'// 'm/d/Y'
$lngstr['language']['date_format'] = '%m/%d/%y %I:%M %p'// 'm/d/y g:i a'
$lngstr['language']['date_format_full'] = '%B %d, %Y %I:%M:%S %p'// 'F j, Y g:i:s a'
$lngstr['language']['calendar']['date_format'] = '%Y-%m-%d %H:%M'

Última edición por disguiseddevil; 03/10/2012 a las 11:35 Razón: mas cosas