I'm trying to create a DateTime objet but with a specific DateTimeZone (the server could have it own DateTimeZone). Suppose the following string:
$textoFecha = '15-30-10-2012'; //H-d-m-Y
If I try to do this:
$fecha = DateTime::createFromFormat('H-d-m-Y', $textoFecha);
$fecha->setTimezone(new DateTimeZone("America/Costa_Rica"));
The result of make echo $fecha->format('H-d-m-Y')
is:
19-30-10-2012
My question is, how can I set the DateTimeZome but keeping the giving values? (15-30-10-2012)