CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2014
    Posts
    5

    Need help converting a string field to date in crystal report

    HI,

    I have a field in my form called {Hosp_Charges_.from_routine} this field is in string and its a date and this filed outputs date like 20110404 I like to turn this field to a date filed like 04/04/2011. can you help please.
    Thanks.

  2. #2
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Need help converting a string field to date in crystal report

    You could use a formula field and write code that:
    0 Declare variables
    1 Extract the month day & year part of the string, using the MID function
    2 Convert to numeric value each one using the TONUMBER function
    3 Use the DATE or DATEVALUE or DATESERIAL functions to convert those extracted parts to a date field
    4 Place the formula field in the desired section
    5 Format as you format a date field
    Last edited by jggtz; March 7th, 2014 at 04:53 PM.
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured