Was this page helpful?

Date.Format

    Table of contents
    1. 1. Usage Restrictions
    2. 2. Parameters
    3. 3. Result
    4. 4. Samples
    date.Format(datetime : str, format : str) : str 

    Formats a date according to the specified format string.  See .Net documentation for formatting date-time for more information on format strings.

    Usage Restrictions

    1.8.1 or later;  8.08 or later for ISO week-date formats.

    Parameters

    Name Type Description
    datetime str The date to format.
    format str The format string.  Additional ISO 8601 week-date formats available:
    Format Content Example: "12/31/2007"
     "iso-yyyy-Www-d"  yyyy-Www-d  "2008-W01-1"
     "iso-yyyy-Www"  yyyy-Www-d  "2008-W01"
     "iso-Www-d"  yyyy-Www-d  "W01-1"
     "iso-yyyy"  yyyy-Www-d  "2008"
     "iso-Www"  yyyy-Www-d  "W01"
     "iso-d"  yyyy-Www-d  "1"

    Result

    Date formatted according to the format string.

    Samples

      Output

    To display the current date using the full date/time pattern:

    {{ date.Format(date.now, "F") }} 

    Saturday, May 18, 2013 9:37:53 PM

    To display a constant date using a custom format:

    {{ date.Format("01/01/2000", "dd-MM-yy") }} 

    01-01-00

     

    To display the current using a custom format: 

    {{ date.Format(date.now, "d-MM-yyyy") }} 

     

    18-05-2013

    Was this page helpful?
    Tag page
    Viewing 3 of 3 comments: view all
    In some reason date.format doesn't account Time zone.
    Example:
    let now1 = date.changetimezone( date.new(2010, 7, 7, 0, 0, 0), "+3:00" );
    <br/> now1;
    <br/> date.format(now1,"dd/MM/yy");

    It is giving me:
    Wed, 07 Jul 2010 00:00:00 +03:00
    06/07/10

    Which value to believe in?
    Posted 04:00, 7 Jul 2010
    @varosi you are correct that this is a bug. it's fixed in the upcoming release.
    Posted 08:23, 7 Jul 2010
    Great! Thanks!
    Posted 08:29, 7 Jul 2010
    Viewing 3 of 3 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by