Skip to Content
avatar image
Former Member

Doctime in Crystal Report

Hi all,

Doctime field in SAP is showing as 12:33PM. But if I'm trying to fetch the doctime field in CR, it is showing as 1233(numeric).

How to convert this into TIME?

Thanks&Regards,

Saikrishna.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 01, 2015 at 01:08 AM

    CREATE FUNCTION [dbo].[ConvertSapTS2TimeString]

    (

      -- Add the parameters for the function here

      @SapTS int

    )

    RETURNS varchar(8)

    AS

    BEGIN

      -- Declare the return variable here

      DECLARE @TimeString varchar(8)

      DECLARE @Str varchar(6);

      -- Add the T-SQL statements to compute the return value here

      SET @Str = CAST(@SapTS AS VARCHAR(6));

      IF @SapTS < 100000

      BEGIN

      SET @TimeString = '0' + SUBSTRING(@STR, 1, 1) + ':' + SUBSTRING(@STR, 2, 2) + ':' + RIGHT(@STR, 2);

      END

      ELSE

      BEGIN

      SET @TimeString = LEFT(@STR, 2) + ':' + SUBSTRING(@STR, 3, 2) + ':' + RIGHT(@STR, 2);

      END;

      -- Return the result of the function

      RETURN @TimeString

    END

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 01, 2015 at 09:02 AM

    Hi

    in the Crystal report you should use the print time from the special fields it will look fine

    shachar

    Add comment
    10|10000 characters needed characters exceeded