Custom Column - Get Date from Datetime format

Answered

Comments

5 comments

  • Avatar
    Andrew Block

    Nishya,


    Prodvided you wanted to display just as you presented it would be:

    LEFT([Date],10)

    Or if you wanted an actual Date field out of that you could use the following:

    CreateDate(TOINT(RIGHT(LEFT([Date],10),4)),TOINT(RIGHT(LEFT(Date,5),2)),TOINT(LEFT([Date],2)))

    This is just something I put together quick there may be a more elegant solution 


    Let me know if you have any questions

    0
    Comment actions Permalink
  • Avatar
    Nishya Sathianesan

    Andrew,

    Thanks for the answer. Isn't CreateDate(TOINT(RIGHT(LEFT([Date],10),4)),TOINT(RIGHT(LEFT(Date,5),2)),TOINT(LEFT([Date],2))) again giving the output in Date time format? And if i am not wrong LEFT([Date],10) is string format? I want the output of  LEFT([Date],10) but in Date format not as string. Thank you.

    0
    Comment actions Permalink
  • Avatar
    Andrew Block

    Nishya,

    Technically what you provided is a string representation of a date time format from some source system I am assuming. I believe Sisense only allows date to be formatted as (year,month,day), you could however just use it as as string.

    0
    Comment actions Permalink
  • Avatar
    Andrew Block

    Using my second option to convert it an actual Date field in the ECM, you can then format it in dashboard how you want such as 

    2
    Comment actions Permalink
  • Avatar
    Daniel Cook

    Why isn't there simply a ToDate(datetime) function, or the ability to CAST(datetime as date)? It's a very very common scenario.

    9
    Comment actions Permalink

Please sign in to leave a comment.