cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Nintex Newbie

format the Date and remove the Time within the repeated section

Jump to solution

Using a Date Only field within the nintex form as a repeated section.

Unfortunately, the date date format includes the time 00:00:00 when the data is submitted.

 

I have tried to format the field via the String Format etc. but not much luck.

DateFormat.jpg

 

Can this not be done otherwise?
I am not keen to use workflow as I am not very profficient in it (unless u help me :) )

Labels: (1)
Tags (1)
0 Kudos
Reply
12 Replies
Highlighted
Automation Master
Automation Master

Re: format the Date and remove the Time within the repeated section

Jump to solution

'String Format' only applies to form control and only in VIEW mode.

date control is always saved in full datetime format.

 

why do you need to save it without time portion?

 

you may add a calculated value control to repeating section and set up its formula to output data in your desired format.

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: format the Date and remove the Time within the repeated section

Jump to solution

why do you need to save it without time portion?
Because the data is then send to the user, which in case always shows the Date 00:00:00 and this is the annoying part and my manager requested to remove it as it's confusing.

 

I have used the XML Query (XSLT) to get the info and then e-mail to the user.

Unless there is a way of formating the XML to remove the time stamp?

 

I also tried the calculated value

formatDate(ItemDate, "dd/MM/yyyy")

 but it gives me an error: #Value!

0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: format the Date and remove the Time within the repeated section

Jump to solution
Because the data is then send to the user,

you should format it when  you create notification, not how it stored.

 

 

 

I have used the XML Query (XSLT) to get the info and then e-mail to the user.

Query XML returns a date-like fromatted string, so you could use string fumctions or regular expression action to get rid of time part.

or you could convert returned date-like fornatted string into a date (datetime variable) and then use formatDate() inline function to convert it back to a string in desired format.

 

 

 

I also tried the calculated value

where? in forms or in workflow?

it's a inline function so in both cases it should look like fn-formatDate(....)

 

i.jpg

 

 

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: format the Date and remove the Time within the repeated section

Jump to solution

@emha 

 

I have looked into the XML and searched for dateFormating.

Thanks to this page, I was able to format the date ....

 

In my case the date format was eg. 05/09/2015 00:00:00

the 'substring' checks before the 00 and then sets the mm/dd/yyyy based on substring characters.

 

my finished XML (XSLT) code:

 

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <!-- transform repeating section from xml to html -->

  <xsl:template name="formatdate">
     <xsl:param name="DateTimeStr" />

     <xsl:variable name="datestr">
         <xsl:value-of select="substring-before($DateTimeStr, '00')" />
     </xsl:variable>

     <xsl:variable name="dd">
         <xsl:value-of select="substring($datestr,4,2)" />
     </xsl:variable>

     <xsl:variable name="mm">
        <xsl:value-of select="substring($datestr,1,2)" />
     </xsl:variable>

     <xsl:variable name="yyyy">
        <xsl:value-of select="substring($datestr,7,4)" />
     </xsl:variable>

     <xsl:value-of select="concat($dd,'/', $mm, '/', $yyyy)" />
  </xsl:template>

  <xsl:template match="/">
    <table>
      <thead>
        <tr>
          <td width="70px">
            <b>Items</b>
          </td>
          <td>
            <b width="100px">Description</b>
          </td>
          <td>
            <b>Status</b>
          </td>
          <td>
            <b>Date</b>
          </td>
          <td>
            <b>Collected By</b>
          </td>
        </tr>
      </thead>
      <tbody>
        <xsl:for-each select="RepeaterData/Items/Item[ItemStatus!='Booked']">
          <tr>
            <td>
              <xsl:apply-templates select="ItemNumber"/>
            </td>
            <td>
              <xsl:apply-templates select="ItemDescription"/>
            </td>
            <td>
              <xsl:apply-templates select="ItemStatus"/>
            </td>
            <td>
              <xsl:call-template name="formatdate">
                  <xsl:with-param name="DateTimeStr" select="ItemDate"/>
              </xsl:call-template> 
            </td>
            <td>
              <xsl:apply-templates select="CollectedByUser"/>
            </td>
          </tr>
        </xsl:for-each>
      </tbody>
    </table>
  </xsl:template>
</xsl:stylesheet>

 

 

View solution in original post

Reply
Highlighted
Nintex Newbie

Re: format the Date and remove the Time within the repeated section

Jump to solution

Hi,

I encountered the same problem. I saw the solution you posted on this page but can you please show me how you incorporate it either on the nintex form or the workflow? Thank you in advance.

0 Kudos
Reply
Highlighted
Nintex Employee
Nintex Employee

Re: format the Date and remove the Time within the repeated section

Jump to solution

@Joe I'm guessing they are using the Process using XSLT option in the Query XML action.

 

xslt.png

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: format the Date and remove the Time within the repeated section

Jump to solution

Hi @SimonMuntz ,

Thanks for your reply. I did exactly what you instructed, and I copied the xml(xslt) code @bimi82 posted above to the text box below it. I guess I did wrong because it didn't work. Can you tell me what to do next? Where should I put the xml code? Can you tell me what my miss is?. I had already given up figuring it out a few months back until I have been given a new task again recently which I'm still having a hard time with. i guess I can't really get away with it. I really appreciate your help on this. 

0 Kudos
Reply
Highlighted
Nintex Employee
Nintex Employee

Re: format the Date and remove the Time within the repeated section

Jump to solution
I would do it like the earlier posts and use a format date inline function after extracting the date from the XML.

What are you doing with the metada extracted? Are you putting itno an email or creating new items etc?
0 Kudos
Reply
Highlighted
Nintex Newbie

Re: format the Date and remove the Time within the repeated section

Jump to solution

@SimonMuntz 

Thanks for responding. Basically, I have a workflow and I used xml query action to extract data from repeated section on the nintex form, which is then stored in one of the column in the list called "timeoffs". So when new item is created the data stored in the list shows the dates like this, 12/20/2019 00:00:00, 12/21/2019 00:00:00, 12/22/2019 00:00:00. I want to get rid of those 00s before it gets stored to the column. I thought using an inline function within the date/time control on the form to remove those 00s would work, but it didn't so I tried fixing it in the workflow. But I coudn't figure out how to do it. Do you have any suggestions? Thanks

0 Kudos
Reply