Jump to content

Search the Community

Showing results for tags 'prepttime'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hello. Working on my cooking recipes profile I need some time conversion to preptime duration as per ISO 8601. For the moment I have a few lines of code that take the value of $page->recipe_cook_time (in minutes) and convert it to human readable time for the frontend (ex. 1d 2h 35m): $d = floor ($page->recipe_cooking_time / 1440); $h = floor (($page->recipe_cooking_time - $d * 1440) / 60); $m = $page->recipe_cooking_time - ($d * 1440) - ($h * 60); if ($d > 0) { $cooking_time = $d . ' d '; } if ($h > 0) { $cooking_time .= $h . 'h '; } if ($m > 0) { $cooking_time .= $m . 'min'; } Now I am trying to convert the minutes of $page->recipe_cook_time into ISO 8601 duration (ex. P1DT1H35M) but am stuck and get different results instead of the right timing. Any suggestions about the conversion or even if you know of a function that can smarter convert minutes to human readable D:H:M ?
×
×
  • Create New...