Skip to Content
author's profile photo Former Member
Former Member

Part of a Date Field

I am interested in getting part of a date field. The date fileld is displayed as follows. Its in 6 minute interval of data

6/1/2008 12:00:00AM 0.00

6/1/2008 12:06:00AM 0.00

I just want

6/1/2008 12:00

6/1/2008 12:06

Is there any way to achieve this in Crystal Reports

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 01, 2008 at 05:04 PM

    Yes, right click the field to bring up the formatting and use the customize datetime so you just get the date and time without seconds.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 01, 2008 at 06:46 PM

    Hi Srinivasa Prabhu,

    Try the following formula;

    datevar x;

    stringvar y;

    x:=date({Orders.Ship Date});

    if length(totext(time({Orders.Ship Date}))) = 10

    Then y:=left(totext(time({Orders.Ship Date})),5)

    else Y:=left(totext(time({Orders.Ship Date})),4);

    x&' '&y;

    Regards,

    Sastry

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 02, 2008 at 04:50 AM

    Have you figured this out yet?

    There has been a few more suggestions, but the simplest is still to just customize the display of the field. That is as long as the field is a datetime in the DB.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 01, 2008 at 07:32 PM

    If you need to format it as a string, you can do so using the totext function:

    totext({table.field},"M/d/yyyy h:m")

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.