{$variable|jrCore_format_time}

  • Overview

    The |jrCore_format_time variable modifier allows the formatting of a timestamp into various readable date formats
  • jrCore_format_time

    Function
    jrCore_format_time
    parameter
    type
    default
    required
    description
    $timestamp
    int
    -
    on
    a unix timestamp
    $date_only
    bool
    false
    Set to true to just return DATE portion (instead of DATE TIME)
    $format
    -
    Date Format for Display. accepts the formats from here http://php.net/manual/en/function.strftime.php or "relative"
    format a timestamp to a human readable date
  • examples

    modifiers can be added to the variable modifier to alter the output, here are some examples for use in a template:
    {$variable|jrCore_format_time} // 23/12/13 00:00:00
    
    {$variable|jrCore_format_time:true} // 23/12/13
    
    {$variable|jrCore_format_time:false:"relative"} // 10 days ago
    
    {$variable|jrCore_format_time:false:"%Y-%m-%d"}} // 2009-02-05
    
    {$variable|jrCore_format_time:false:"%F"}} // Same as "%Y-%m-%d"
    
    

Tags