Clarity

  • 1.  How to display full current date time?

    Posted Aug 11, 2013 10:12 PM
    Hello Guys,

    Clarity 13.1 / MSSQL

    I have a custom attribute (data type 'Date') using option 'Current Date Time', this attribute is updated through Gel-Script simple statement using GETDATE()

    The process is executed correctly, but in the attribute appears MM/DD/YYYY, but I need to show full path (including Hour/Minute/Seconds), using this format:

    YYYY-MM-DD HH:MM:SS

    Please check this screen shots as reference

    My custom script is:

    <gel:script xmlns:j="jelly:core"
    xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
    xmlns:sql="jelly:sql"
    xmlns:core="jelly:core">

    <core:set var="v_projectid" value="${gel_objectInstanceId}"/>

    <gel:setDataSource dbId="niku"/>
    <gel:log level="DEBUG" category="PROCESS">Processing : ${v_projectid}</gel:log>
    <sql:update>
    UPDATE ODF_CA_PROJECT
    SET custom_date = getdate()
    FROM INV_INVESTMENTS
    WHERE INV_INVESTMENTS.id = ODF_CA_PROJECT.id
    AND INV_INVESTMENTS.id = '${v_projectid}'
    </sql:update>

    </gel:script>

    Thanks you


  • 2.  RE: How to display full current date time?

    Posted Aug 12, 2013 01:49 AM
    Try
    SET custom_date = convert(varchar,getdate(),20)

    See
    http://msdn.microsoft.com/en-US/library/ms187928%28v=sql.90%29.aspx

    Martti K.


  • 3.  RE: How to display full current date time?

    Posted Aug 12, 2013 10:20 PM
    Martti,

    Thanks for your effort and advice.

    Unfortunately I tried to change my custom code using the suggested command:
    custom_date = convert(varchar,getdate(),20)

    However the result is the same, is shown as my previous screen, despite database is stored as I need

    I wonder if is required some setting in application server (some regarding time zone / format hour / etcetera).

    In the past I was able to do it showing the full path, but now I cannot do it.

    Note: The attribute custom date was created as read - only

    Thanks again


  • 4.  RE: How to display full current date time?
    Best Answer

    Posted Aug 13, 2013 03:10 AM
      |   view attached
    In the FIELDS options (not the ATTRIBUTE options), can you set the display type to Date & Time ?

    .


  • 5.  RE: How to display full current date time?

    Posted Aug 14, 2013 01:49 PM
    Thanks you so much

    This was my wrong setting

    Thanks you


  • 6.  RE: How to display full current date time?

    Posted Aug 13, 2013 03:12 AM
    Just a little background to my previous reply.

    The dates seem to be stored in the database in a format which includes the date and time.
    You can see that if you query any date field or have that in a lookup.
    When you have a date field in Clarity the time is stripped and only the date is displayed. That happens also when you have a portlet 8query basedof object based).
    The way I have worked around that is, is to convert the timestamp to a string. That is also what I proposed above and I have used in portlets.
    Apparently there is more to it in gel.

    Anyway that is what I'd pursue catch the timepart of the date field while it is still there and store it temporarily or into a string so that Clarity will not strip it.

    I don't think the attribute being read only is related to that.

    Martti K.


  • 7.  RE: How to display full current date time?

    Posted Aug 13, 2013 04:38 AM
    Thanks for the education Dave. That certainly works also in a query based portlet.
    Don't I feel smart again.

    Martti K.



    .