Page Blocks

Hosting sponsored by:

Point In Space

 

API: Date

Filename:
fwpDate_isoDateTime.ctag

Released With:
5.1.0

Current Version:
1.1.0

Status: Active

Min Lasso Tested: 8.1.0

Max Lasso Tested: 8.5.3

Related:

Still don't get it?

Check out the talk list archives, or join and ask your questions.

Documentation Error or Request?

Email documentation corrections or comments

API Reference

fwpDate_isoDateTime (Tag)

Description

Reformats a supplied Lasso date string in the format of yyyy-mm-dd hh:mm:ss

Syntax

[fwpDate_isoDateTime:dateString]

A dateString is a string data type that Lasso accepts as a legal format for a date.

Parameters & Member Tags

dateString (unnamed) = required : any valid Lasso date or date string

Examples

[fwpDate_isoDateTime: (field:'startDate')]

[fwpDate_isoDateTime: $closeDate]

Source Code

View in separate window

<?lassoscript
//............................................................................
//
//    pageblocks: (c) 2002-2007 http://www.pageblocks.org/
//
//............................................................................
/*

    {fileName=        fwpDate_isoDateTime.ctag }
    {rsrcType=        tag }
    {rsrcName=        fwpDate_isoDateTime }
    {rsrcHTTP=        www.pageblocks.org/refc/fwpDate_isoDateTime }

    {lassoVrsnMin=    8.1.0 }
    {lassoVrsnMax=    8.5.3 }

    {author=        Greg Willits }
    {authorEmail=    subscribe to pbTalk at www.pageblocks.org/talk/ }
    {authorHTTP=    www.pageblocks.org }

    {desc=            Returns a date or date/time in ISO format. If the time is 
                    zero, then 06:00:00 is added to bypass daylight savings
                    times. The -euro parameter can be specified with or
                    without a value. }

    {maintvsrn=        1.1 }
    {maintrelease=    5.1.7 }
    {maintdate=        2007-05-26 }
    {maintauthor=    Greg Willits }
    {maintnotes=    updated for changes to date handling introduced in 8.5.2
                    and generally cleaned up and simplified.
                    Also eliminated -euro option as it isn't needed, and didn't
                    work for some dates. }

    {maintvsrn=        1.0.1 }
    {maintrelease=    5.1.0 }
    {maintdate=        2006-06-14 }
    {maintauthor=    Greg Willits }
    {maintnotes=    added -dstproof option }

    {maintvsrn=        1.0 }
    {maintrelease=    5.1.0 }
    {maintdate=        2006-06-13 }
    {maintauthor=    Greg Willits }
    {maintnotes=    initial release }

*/
//.............................................................................

define_tag:'fwpDate_isoDateTime', 
    -priority = 'replace',
    -required = 'dateString', -copy,
    -optional = 'dstproof';
    
    local:'makeDSTProof'     = false;

    (params >> '-dstproof')
        ? #makeDSTProof = true;

    if: (#dateString != '') && (#dateString !>> '0000') && (valid_date: #dateString);

        #dateString = (date_format: (date:#dateString), -format='%Q %T');

        #makeDSTProof && (#dateString >> '00:00:00')
            ? #dateString->(replace:'00:00:00','06:00:00');

        return: #dateString;

    /if;

/define_tag;
?>




© 2002-2010, pageblocks.org