Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Date format
  • Hi, when you use the class Date::time()->format("%Y-%m-%d"), you can chosse the format of your date,
    I want to do the same with a sql result like : ($newsrh->dateupload)->format("%Y-%m-%d"), is there a way to do it in fuel? is there a class format I didn't find it
    thank you for your help
  • How do you mean "with a sql result"? Do you mean a MySQL timestamp? In that case:
    Date::create_from_string($newsrh->dateupload, 'mysql')->format('%Y-%m-%d'); http://docs.fuelphp.com/classes/date.html#/method_create_from_string
  • no i mean,i do a request in my database and display the result on my page, my fiel in the database is a date and I want to display my date with a correct format for the users. I hope I'm clear. thank you
  • That is what Jelmer explained. As format string you can use any format supported by strftime(), and some shortcuts that are defined in app/config/date.php (you can add more if needed).
  • thanks for your help

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion