Topic
10 replies Latest Post - ‏2012-12-28T04:30:09Z by SystemAdmin
SystemAdmin
SystemAdmin
6772 Posts
ACCEPTED ANSWER

Pinned topic TimeStamp Format

‏2012-10-23T03:33:16Z |
Hi

I am trying to insert current time stamp value in the body.

Could anyone please let me know what function i need to use in order get the value in the following format

<timestamp>2012-10-22 07:07:10.458</timestamp>

Timestamp format *yyyy-mm-dd hh:mm:sshttp://.fffffffff*'
(example : '*2012-10-22 07:07:10.458*')

Thanks,
SS
Updated on 2012-12-28T04:30:09Z at 2012-12-28T04:30:09Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    6772 Posts
    ACCEPTED ANSWER

    Re: TimeStamp Format

    ‏2012-10-23T03:38:45Z  in response to SystemAdmin
    Time stamp format -> yyyy-mm-dd hh:mm:ss.fractions
    example -> 2012-10-16 07:07:10.458
    • HermannSW
      HermannSW
      4327 Posts
      ACCEPTED ANSWER

      Re: TimeStamp Format

      ‏2012-10-23T12:55:04Z  in response to SystemAdmin
      Several solution on "timestamp with milliseconds" have been posted in this Forum.
      This is a solution on how to take timezone into account in addition:
      https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14809526#14846798

       
      Hermann<myXsltBlog/> <myXsltTweets/>
      • SystemAdmin
        SystemAdmin
        6772 Posts
        ACCEPTED ANSWER

        Re: TimeStamp Format

        ‏2012-10-24T15:50:54Z  in response to HermannSW
        Hi Herman,

        according to my requirement I have to generate only 2012-10-24 15:21:59.39
        but when i am using the code as you mentioned I am getting 2012-10-24T15:21:59:39

        Please advice.
        • Liv2luv
          Liv2luv
          573 Posts
          ACCEPTED ANSWER

          Re: TimeStamp Format

          ‏2012-10-24T16:30:58Z  in response to SystemAdmin
          I would try:

          <xsl:value-of select="translate('2012-10-24T15:21:59:39','T',' ')"/>
          • HermannSW
            HermannSW
            4327 Posts
            ACCEPTED ANSWER

            Re: TimeStamp Format

            ‏2012-10-24T19:48:17Z  in response to Liv2luv
            Suresh is right, see it in action here (for US eastern time):
            $ echo "<x/>" | xpath++ "translate(concat(date:add('1969-12-31T20:00:00',concat('PT',floor(dp:time-value() div 1000),'S')),':',dp:time-value() mod 1000), 'T', ' ')" -
            2012-10-24 15:47:15:44
            $ echo "<x/>" | xpath++ "translate(concat(date:add('1969-12-31T20:00:00',concat('PT',floor(dp:time-value() div 1000),'S')),':',dp:time-value() mod 1000), 'T', ' ')" -
            2012-10-24 15:47:15:619
            $ echo "<x/>" | xpath++ "translate(concat(date:add('1969-12-31T20:00:00',concat('PT',floor(dp:time-value() div 1000),'S')),':',dp:time-value() mod 1000), 'T', ' ')" -
            2012-10-24 15:47:16:131
            $
            


             
            Hermann <myXsltBlog/> <myXsltTweets/>
            Updated on 2014-03-25T02:46:58Z at 2014-03-25T02:46:58Z by iron-man
            • SystemAdmin
              SystemAdmin
              6772 Posts
              ACCEPTED ANSWER

              Re: TimeStamp Format

              ‏2012-10-24T20:17:13Z  in response to HermannSW
              Thanks Hermann and Suresh for your inputs. it's working now.
            • SystemAdmin
              SystemAdmin
              6772 Posts
              ACCEPTED ANSWER

              Re: TimeStamp Format

              ‏2012-12-27T20:12:19Z  in response to HermannSW
              Hi,

              I can able to generate time stamp what exactly I needed (ex: 2012-12-27 10:55:47.509)
              but time value populating 1 hour ahead then current time.

              I was triggered transaction at 2012-12-27 10:55:47.509
              but output populating 2012-12-27 11:55:47.509
              any thoughts?
  • SystemAdmin
    SystemAdmin
    6772 Posts
    ACCEPTED ANSWER

    Re: TimeStamp Format

    ‏2012-12-27T20:13:10Z  in response to SystemAdmin
    adding 1 extra to current time