This topic is locked

date - first day of week problem

3/9/2006 8:06:40 AM
PHPRunner General questions
D
diego author

Olá forum,

i have a problem whit to show the first date of week on form

i have creat a function to show this
function now2()

{

$dia_semana = strftime("%w");

$dia_hj = strftime("%d");

$mes = strftime("%m");

$ano = strftime("%Y");

$zero = 0;

$primeiro_dia = $dia_hj - $dia_semana;
echo "$zero$primeiro_dia/$mes/$ano";
return "$zero$primeiro_dia/$mes/$ano";

}
in echo its works and show correct date

ex: 05/03/2006
in return its show a blank.

my filed is a "date" format in postgresql and "Edit as" on phprunner as Date

what to show this echo on dafault value?
bad english i from brazil

=)

D
diego author 3/9/2006

I have used string to time "strtotime" this return a error

my code

function now2()

{

$dia_semana = strftime("%w");

$dia_hj = strftime("%d");

$mes = strftime("%m");

$ano = strftime("%Y");

$zero = 0;

$primeiro_dia = $dia_hj - $dia_semana;
echo "$zero$primeiro_dia/$mes/$ano";
//return "$zero$primeiro_dia/$mes/$ano";

return strtotime("$zero$primeiro_dia/$mes/$ano");

}


error returned

Informações Técnicas

Tipo de Erro 8

Descrição do Erro Undefined offset: 13

URL www.site.com.br/restrito/intranet/cronograma/crono_desenv/a/cronograma_new_add.php?

Arquivo de Erro /home/httpd/html/restrito/intranet/cronograma/crono_desenv/a/include/locale.php

Linha com Erro 669

Sergey Kornilov admin 3/13/2006

Diego,
you should return date in YYYY-MM-DD format.

So here is the correct returnstatement:

return $ano."-".$mes."-".$primeiro_dia;