Formatting Dates in ToolTip Client Template

Thread is closed for posting
3 posts, 0 answers
  1. Jenn
    Jenn avatar
    5 posts
    Member since:
    Oct 2014

    Posted 11 Nov 2014 Link to this post

    In a Column Chart, I am trying to format a date in a Tooltip's ClientTemplate and  I can't seem to figure it out.

    On the Y-Axis I have dollar amounts, on the X-Axis I have the 24 hours of the day (12am, 1am, 2am, ... 11pm). The X-Axis labels work fine (well, I wish I could lowercase the AM/PM, but that's another issue) using the following:

    <LabelsAppearance DataFormatString="htt" RotationAngle="0" />

    Unfortunately, when I use the following ToolTips template the X-Axis value renders as a long format date like "Tue Nov 11 2014 03:00:00 GMT-0600 (Central Standard Time)" rather than "3AM":

    <TooltipsAppearance BackgroundColor="#ffffff" Color="#5ab7de">

    How do I get #=category= to format my date like this: 4PM?
  2. Jenn
    Jenn avatar
    5 posts
    Member since:
    Oct 2014

    Posted 12 Nov 2014 Link to this post

    Well, to answer my own question. This took me forever to find in the documentation... because it's not in the documentation, rather it is on a demo page for Date Axis:

    #= kendo.format(\'{0:htt}\', category) #
  3. DevCraft R3 2016 release webinar banner
  4. Danail Vasilev
    Danail Vasilev avatar
    1475 posts

    Posted 14 Nov 2014 Link to this post

    Hello Jenn,

    You may also find useful the following help article that shed more light on the matter:
    • Formatting Dates - List of standard and custom date formats.
    • Formatting Numbers- The section "Formatting Labels and Tooltips by using their Client Templates" provides an example on how to format values in templates.
    • Overview - Shows how to configure templates.

    Danail Vasilev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top