Hello all, please help :
I am using ubuntu based dot net core image 3.0 .
My aim is very simple, i just need to find out current CST time.
I have installed the tzdata package but still getting ResponseMessage: "System.TimeZoneNotFoundException: Exception of
type ‘System.TimeZoneNotFoundException’ was thrown.↵ at TimeZoneConverter.TZConvert.GetTimeZoneInfo(String windowsOrIanaTimeZoneId)↵
Here is my docker file :
`FROM mcr.microsoft.com/dotnet/core/sdk:3.0-bionic AS build-env
WORKDIR /app
ADD UbuntuScript.sh /UbuntuScript.sh
RUN /UbuntuScript.sh
Copy everything else and build
COPY . ./
RUN dotnet publish xyz -c Release -o out
Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-bionic
WORKDIR /app
#COPY --from=build-env /app/out .
COPY --from=build-env /app/out .
ENTRYPOINT [“dotnet”, “xyz.dll”]`
Ubuntu Script file :
set noninteractive installation
export DEBIAN_FRONTEND=noninteractive
#install tzdata package
apt-get update
apt-get install tzdata -y
set your timezone
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata
dot net core code where i am using
TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneConverter.TZConvert.GetTimeZoneInfo(“Central Standard Time”));