in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Problem Formatting a DateTime Variable

Last post 05-15-2008 2:20 PM by C1_JohnAd. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-14-2008 5:45 PM

    Problem Formatting a DateTime Variable

    I am creating a bar chart using a DateTime variable from SQL Server as one axis. If I allow it to display the default format the data appears correctly. Since the default shows both date and time, I want to use a custom format to display only the Date. If I enter ANY formatting in the Format field, I get garbage, The dates all display starting in 1899.

     

    Is there a trick to getting formatted dates on a chart - or is this a bug?

     

    Bob M

  • 05-15-2008 2:20 PM In reply to

    Re: Problem Formatting a DateTime Variable

     
    Hello Bob,
     
    There are two way you can try to implment the dates.
     
    Option 1:
     
    You can make use of different Formats available for X axis. For example:
     

              Me.C1Chart1.ChartArea.AxisX.AnnoFormat = C1.Win.C1Chart.FormatEnum.DateShort

    You will get various other date format options as enumeration while
    setting the AnnoFormat property.
     
    Option 2:
     
    You can set your custom format as well using the AnnoFormatString() property.
     
            Me.C1Chart1.ChartArea.AxisX.AnnoFormatString = "dd/MM/yyyy"
     
    I hope this will help.
     
    Regards,
     
    Allen Smith

    I am creating a bar chart using a DateTime variable from SQL Server as one axis. If I allow it to display the default format the data appears correctly. Since the default shows both date and time, I want to use a custom format to display only the Date. If I enter ANY formatting in the Format field, I get garbage, The dates all display starting in 1899.

     

    Is there a trick to getting formatted dates on a chart - or is this a bug?

     

    Bob M



    http://helpcentral.componentone.com/cs/forums/p/75249/204867.aspx#204867

Page 1 of 1 (2 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.