Results 1 to 7 of 7

Thread: [RESOLVED] Converting a string to a date?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    27

    Resolved [RESOLVED] Converting a string to a date?

    Hi all

    I have a field in my report that is a string which accepts dates from my database.

    The data in the database is stored as a string in the format "20070817" , i wish to be able to format it in ways such as "Wednesday, November 12, 2007" for example.

    Can any one tell me how to do this?
    Thanks!


  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Converting a string to a date?

    Create a formula that converts the string to a date. Something like (Crystal syntax)

    DateValue(Left({Date Field},4) + "/" + Mid({Date Field},5,2) + "/" + Right({Date Field},2) )

    Since the formula returns a date, you can now format/display it anyway you want.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    27

    Re: Converting a string to a date?

    hi bruce,

    thanks for helping me, the problem with any date formula that i try to do is that i get a "The result of selection formula must be boolean". any idea why this is?

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Converting a string to a date?

    Where are you creating the Formula? Are you trying to create a conditional formula for one of the formatting options?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    27

    Re: Converting a string to a date?

    Im "right clicking" the field that holds the string of data. then i go to "select expert" and i try to type in the formula there.

  6. #6
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Converting a string to a date?

    The "Select Expert" is probably for data retrieval, ie the Where clause of a SQL statement.

    Delete the string field from the report.
    Create a new formula using the code I posted earlier.
    Add the formula to the report.
    Right click the formula field and format it accordingly.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    27

    Re: Converting a string to a date?

    ahhhh, im such a newb!
    thanks again for your help!

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