@Subhodeep Chakraborty Thanks for using Microsoft Q&A !!
You can use Function like below to convert local DateTime to specific timezone -
DECLARE @func Func<DateTime,DateTime> = (d) => {
TimeZoneInfo cstZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
DateTime.SpecifyKind(d, DateTimeKind.Local);
DateTime estTime = TimeZoneInfo.ConvertTime(d, cstZone);
return estTime;
};
@data =
SELECT data FROM
( VALUES
(DateTime.UtcNow)) AS T(data);
@result =
SELECT @func(data).ToString("dd-MM-yyyyThh:mm:ss") AS data FROM @data;
OUTPUT @result
TO "datafolder/data.csv"
USING Outputters.Tsv();
Result:
----------
Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.