[development] problem with custom date and timezones
Lluís
enboig at gmail.com
Fri Jul 17 10:42:25 UTC 2009
Making some research my problem is with format date:
$node->data_assentament -> 1247781600
date("d-m-Y H:i", $node->data_assentament) -> 17-07-2009 00:00
format_date($node->data_assentament,'medium') -> Dij, 07/16/2009 - 22:00
(I need the date in dd/mm/YYYY format)
Should I avoid format_date() or there is a better way to solve this?
On Thu, Jul 16, 2009 at 5:40 PM, Lluís<enboig at gmail.com> wrote:
> I have created a custom node type. I have a date field which I created
> as int in order to use it in views, being able to sort it, format,
> etc....
>
> My problem right now is that when inserting a node with one date, it
> appears as "day before" when viewing the node. How should I save it to
> avoid this problem?
>
> My form looks like
> $arrayF=getdate(($node->data_paper>0 ? $node->data_paper : time()));
> $arrayF['month']=$arrayF['mon'];
> $arrayF['day']=$arrayF['mday'];
> $form['data_paper_array'] = array(
> '#type' => 'date',
> '#title' => 'Data Factura',
> '#default_value' => $arrayF,
> '#required' => TRUE,
> '#weight' => -9,
> );
>
> My insert query looks like
> $dateF=$node->data_paper_array;
> $factura_tmsp=mktime(0,0,0,$dateF['month'],$dateF['day'],$dateF['year']);//
> $date['year']."-".$date['month']."-".$date['day'];
> $node->data_paper=$factura_tmsp;
> db_query("INSERT ......);
>
> And my theme function:
> $output.="<li><b>Data Factura:</b>
> ".format_date($node->data_paper,'small')."</li>";
>
>
> Any hint/advice? Thanks
>
> --
> *La vida és com una taronja, què esperes a exprimir-la?
> *Si creus que l'educació és cara, prova la ignorància.
> *La vida és com una moneda, la pots gastar en el que vulguis però
> només una vegada.
> *Abans d'imprimir aquest missatge, pensa en el medi ambient.
>
--
*La vida és com una taronja, què esperes a exprimir-la?
*Si creus que l'educació és cara, prova la ignorància.
*La vida és com una moneda, la pots gastar en el que vulguis però
només una vegada.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.
More information about the development
mailing list