Dear Tahir,
I assume that you are using the EPW weather file for Almeira, Spain from this website:
EPW Weather Files for Spain
The source of that data is described here:
Spanish Weather for Energy Calculations (SWEC)
The EPW weather file format is described in the documents linked from this page:
Weather Data Format Definition
The time convention for SAM's solar performance models is described in SAM's Help system:
Weather Data Overview
Have you tried comparing the results of your code with data from one of the TMY2 files included with SAM? Those files follow the time convention described in Help. I am not sure if the SWEC data for Spain uses some other convention.
Best regards,
Paul.