cancel
Showing results for 
Search instead for 
Did you mean: 

Date and time

Former Member
0 Kudos

Hi All,

SAP Stores its document date and time in separate fields and I need to combine into a proper datetime format using a simple SQL query:

Select docdate, doctime from oinv shows:

docdate doctime

2011-12-02 00:00:00.000 1630

2012-02-09 00:00:00.000 943

Should show in proper datetime format:

2011-12-02 16:30:00.000

2012-02-09 09:43:00.000

Does anyone have SQL code for this?

Regards

Aubrey

View Entire Topic
former_member218051
Active Contributor
0 Kudos

Hi,

Try This

SELECT convert(varchar,docdate,104) + ' ' + left(convert(varchar,doctime,102),2) + ' : ' + right(convert(varchar,doctime,102),2) from oinv

thanking you

Malhaar

Former Member
0 Kudos

Hi Malhaar

Thank you it work perfectly fine, , does it work with times less than 2x hour digits though?

Regards,

Aubrey

former_member218051
Active Contributor
0 Kudos

Hi,

don't understand.

thanks

Malhaar

Former Member
0 Kudos

Hi,

I want the query to be able to pull through a date that is 1:20 instead of 13:20.

Regards,

Aubrey

Former Member
0 Kudos

Hi

Time I meant to say.

Thanks,

Aubrey