Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Getting just the month (or day or year) from a DATEVALUE expression

  1. #1
    Join Date
    Jun 2012
    Posts
    29

    Post Getting just the month (or day or year) from a DATEVALUE expression

    I've looked in the info center and the wiki but haven't found the answer anywhere. I have a date which is a string which I use DATEVALUE to convert. I want to be able to format it to display something like dd MMM yyyy. How do I do that?

  2. #2
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    You mean format as if you would print said date into a date-field? Date-fields are great for formatting, give them your format-string and a valid date, and you are all set.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Jun 2012
    Posts
    29

    Default

    thanks Taqua,

    Following your advice, it took me a bit of time to figure it out and I encountered more questions, but it works great now! Thanks for the help.

    I'l expand on your answer if you don't mind so that others can benefit from my mistakes. :-)

    If the field from the DB is a string, even though it's a date, you cannot simply place the field on the form (which will be a string field) and then morph it to a date field. You have to build a DATEVALUE() function (Open Formula) containing the field from the DB and then drag that onto the report and then morph (Fomat > Morph) that into a date field. Once that's done you set the Format in the Attributes menu.

    If you're like me and needed a refresher on date formats here's ya go:

    Name:  Screen Shot 2012-07-03 at 10.32.55 PM.png
Views: 37
Size:  34.9 KB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.