We recommend switching to the latest versions of Edge, Firefox, Chrome or Safari. Using Internet Explorer will result in a loss of website functionality.

Split DateTime Format into Date and Time

Comments

2 comments

  • Avatar
    Adrian Williams

    If the data is a string that contains the date time value, the first step would be to convert it to a datetime type.

    The Modify Fields node can be used to perform this transformation:

    There are various ways you can then extract the date and time elements from the datetime value. 

    A Transform node can be used as follows:

    Note that the code needs to explicitly handle the case where the value is Null.

    A Calculate Fields node can also be used in a simmilar way:

    In this case, the node was configured so that the default value for a Null datetime value is configured to be Null:

    The Calculate Fields provides alternative default values that can be used when an input datetime value is Null:

    If the  node is configured so that the default for a Null datetime value is set to 'Today', 'Now' or the epoc, the expressions can be simplified to the following:

     

    If you had simply wanted to convert the datetime value to either a Date type or a Time type (without retaining the original datetime field) you can simply use a Modify Fields node:

    An example data flow is attached belows (requires v. 3.6.0 or above).

    The Help documentation includes a topic for Ex-LAE users on using Date, Time and Datetime functions in Data360 Analyze. The documentation also includes topics on other functions too.

    Searching the Community forum for "extract date" will also yield some  additional examples and related information.

     

    Attached files

    Extract Date and Time Elements - 23 Feb 2021.lna

     

    1
    Comment actions Permalink
  • Avatar
    Tevita Fainga

    Thanks Adrian for the help, its work.

    0
    Comment actions Permalink

Please sign in to leave a comment.