CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 date use

Print topic Send  topic

Author Message
Avelino Alonso
Posted: 10/21/2003, 6:56 AM

Hello:
I have a code beforesow in a record form, width this code:
"
$db1 = new clsDBconvergesrobledo();
$SQL = "SELECT * FROM ordenescarga WHERE delegacion_id=" .
$db1->ToSQL(CCGetSession("delegacion_activa"), ccsInteger) . " AND
ORDENCARGA_ID=" . $db1->ToSQL(CCGetParam("ORDENCARGA_ID"), ccsInteger);
$db1->query($SQL);
$Result = $db1->next_record();
if($Result)
{
$ordenesincificha->FECHA->SetValue($db1->f("FECHA"));
$ordenesincificha->CONDUCTOR_ID->SetValue($db1->f("CONDUCTOR_ID"));
$ordenesincificha->CAMION_ID->SetValue($db1->f("CAMION_ID"));
$ordenesincificha->REMOLQUE_ID->SetValue($db1->f("REMOLQUE_ID"));
$ordenesincificha->CLIENTE_ID->SetValue($db1->f("CLIENTE_ID"));
$ordenesincificha->PROVEEDOR_ID->SetValue($db1->f("PROVEEDOR_ID"));
}
$db1->close();
"
All fields work fine, but the field FECHA post value 01/01/1970 (the
original database date is 2003-10-28), I have tryed width diferents formats
but the result is the same
The control $ordenesincificha->FECHA is a date type, and the database field
FECHA is also a date type.

Any help for this?
Thanks.
Avelino Alonso.

Victor Suarez
Posted: 10/31/2003, 8:04 AM

Hi Avelino,

If you don't need the time part, then try declaring a function like this in
your PHP code (it could be changed to consider time):

function DBDateToFieldDate($psDBDate) {
sscanf($psDBDate, "%u-%u-%u %s", $sYear, $sMonth, $sDay, $sTime);
return mktime(0,0,0, $sMonth, $sDay, $sYear);
}

Then, call it before setting the value:

....
$ordenesincificha->FECHA->SetValue(DBDateToFieldDate($db1->f("FECHA")));
....

The field $ordenesincificha->FECHA must be a date field.

Hope it works!

Victor Suarez
vrsuarezd@yahoo.com


"Avelino Alonso" <avelino@big-bros.com> escribió en el mensaje
news:<bn3duk$dgu$1@news.codecharge.com>...
> Hello:
> I have a code beforesow in a record form, width this code:
> "
> $db1 = new clsDBconvergesrobledo();
> $SQL = "SELECT * FROM ordenescarga WHERE delegacion_id=" .
> $db1->ToSQL(CCGetSession("delegacion_activa"), ccsInteger) . " AND
> ORDENCARGA_ID=" . $db1->ToSQL(CCGetParam("ORDENCARGA_ID"), ccsInteger);
> $db1->query($SQL);
> $Result = $db1->next_record();
> if($Result)
> {
> $ordenesincificha->FECHA->SetValue($db1->f("FECHA"));
> $ordenesincificha->CONDUCTOR_ID->SetValue($db1->f("CONDUCTOR_ID"));
> $ordenesincificha->CAMION_ID->SetValue($db1->f("CAMION_ID"));
> $ordenesincificha->REMOLQUE_ID->SetValue($db1->f("REMOLQUE_ID"));
> $ordenesincificha->CLIENTE_ID->SetValue($db1->f("CLIENTE_ID"));
> $ordenesincificha->PROVEEDOR_ID->SetValue($db1->f("PROVEEDOR_ID"));
> }
> $db1->close();
> "
> All fields work fine, but the field FECHA post value 01/01/1970 (the
> original database date is 2003-10-28), I have tryed width diferents
formats
> but the result is the same
> The control $ordenesincificha->FECHA is a date type, and the database
field
> FECHA is also a date type.
>
> Any help for this?
> Thanks.
> Avelino Alonso.
>
>

Avelino Alonso
Posted: 10/31/2003, 11:40 PM

Gracias por tu respuesta Victor,
He utilizado una funcion de PHP que de momento funciona correcto.
strtotime($db1->f("FECHA"));

Te escribo en español pues por tu nombre parece que lo entenderás, gracias.


"Victor Suarez" <vsuarez@lalpiz.com> escribió en el mensaje
news:bnu178$ije$1@news.codecharge.com...
> Hi Avelino,
>
> If you don't need the time part, then try declaring a function like this
in
> your PHP code (it could be changed to consider time):
>
> function DBDateToFieldDate($psDBDate) {
> sscanf($psDBDate, "%u-%u-%u %s", $sYear, $sMonth, $sDay, $sTime);
> return mktime(0,0,0, $sMonth, $sDay, $sYear);
> }
>
> Then, call it before setting the value:
>
> ...
> $ordenesincificha->FECHA->SetValue(DBDateToFieldDate($db1->f("FECHA")));
> ...
>
> The field $ordenesincificha->FECHA must be a date field.
>
> Hope it works!
>
> Victor Suarez
>vrsuarezd@yahoo.com
>
>
> "Avelino Alonso" <avelino@big-bros.com> escribió en el mensaje
>news:<bn3duk$dgu$1@news.codecharge.com>...
> > Hello:
> > I have a code beforesow in a record form, width this code:
> > "
> > $db1 = new clsDBconvergesrobledo();
> > $SQL = "SELECT * FROM ordenescarga WHERE delegacion_id=" .
> > $db1->ToSQL(CCGetSession("delegacion_activa"), ccsInteger) . " AND
> > ORDENCARGA_ID=" . $db1->ToSQL(CCGetParam("ORDENCARGA_ID"), ccsInteger);
> > $db1->query($SQL);
> > $Result = $db1->next_record();
> > if($Result)
> > {
> > $ordenesincificha->FECHA->SetValue($db1->f("FECHA"));
> > $ordenesincificha->CONDUCTOR_ID->SetValue($db1->f("CONDUCTOR_ID"));
> > $ordenesincificha->CAMION_ID->SetValue($db1->f("CAMION_ID"));
> > $ordenesincificha->REMOLQUE_ID->SetValue($db1->f("REMOLQUE_ID"));
> > $ordenesincificha->CLIENTE_ID->SetValue($db1->f("CLIENTE_ID"));
> > $ordenesincificha->PROVEEDOR_ID->SetValue($db1->f("PROVEEDOR_ID"));
> > }
> > $db1->close();
> > "
> > All fields work fine, but the field FECHA post value 01/01/1970 (the
> > original database date is 2003-10-28), I have tryed width diferents
> formats
> > but the result is the same
> > The control $ordenesincificha->FECHA is a date type, and the database
> field
> > FECHA is also a date type.
> >
> > Any help for this?
> > Thanks.
> > Avelino Alonso.
> >
> >
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.