Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to express this function in Phalcon?

How to express this function using Phalcon?

$fecha = DateTime::createFromFormat('j-M-y', $fecha_oracle);

echo $fecha->format('d/m/Y');
edited Aug '16

Not sure what you mean about "this function", but afaik phalcon doesn't have any datetime objects; it uses the php built-in

The translation interface is passing it down to the actual implementor too, so that's no-go


DateTime::createFromFormat Is this not found as object?


Still not sure about your problem...

If it is an exception about DateTime class not found, then it's a namespace problem: either import it with the use keyword, or reference it with a preceding backslash: \DateTime::createFromFormat

Otherwise, yes, $fecha will be a DateTime object which is provided by standard PHP. Phalcon itself does not have any wrapper for formatting dates, so any custom functonality will have to be implemented by yourself


Thanks No problem. I wanted to be sure before implementation