we are following MVC pattern, which is best place for converting toUTC and toLocal in controller or in javascript? Also whether we need to save the date format in invariant culture to support globalization? (or) is there any standard thumb rule/best practice for globalizing date time formats in MVC?
Related Questions in .NET
- file download method in visual studio 2017
- Repository manager receives the wrong connection string in .net core
- MongoDb not connecting C#
- The current .NET SDK does not support targeting .NET Core 6.0. Brand new WPF Project VS Community 2022 17.9.5
- Why Scanning GSI on DynamoDb doesnt work as fast as expected when using CONTAINS?
- Are "blittable types" really unmanaged types for StructLayout Sequential
- Failed to fetch dynamically imported module on Blazor JS Interop
- Problem to upload several images per one request
- Implementing Azure AD B2C Authentication in .NET 8 Blazor Project (RenderMode: InteractiveAuto)
- Stripe connect payout - throws exceptions
- 'IOException: The cloud file provider is not running', when trying to delete 'cloud' folder
- Azure Application Insights Not Displaying Custom Logs for Azure Functions with .NET 8
- Convert C# DateTime.Ticks to Bigquery DateTime Format
- Socket.io nodejs server .NET connection
- Producer Batching Service Bus Vs Kafka
Related Questions in ASP.NET-MVC
- I have a problem outputing the roles on the page ListRoles.cshtml
- Dropdown list showing SQLServer2005SQLBrowserUser$DONSERVER instead of Active Directory group name in ASP.NET MVC C#
- Hosting ASP.NET MVC application on IIS web server using Windows 2019 server
- How to display only department fields associated with a selected department in student automation system?
- How to send select input data for form submission?
- Multi level project reference using dll
- How to upload file to Onedrive using ASP.NET MVC?
- ASP.NET MVC web app looping between fields only on some devices
- Is there any automatic job to load AD-groups?
- How to restrict admin js files to download
- Download PDF in ASP.NET MVC application
- How to add bootstrap theme/example into ASP.NET MVC 5?
- Web API works with Windows authentication enabled when consumed via Swagger but throws an unauthorized issue when accessed through web app
- ASP.Net Core 7.0 Web App (Model-View-Controller) ErrorViewModel OnGet OnPost do not get called or executed
- OAuth 2.0 keep getting Authorization has been denied for this request
Related Questions in DATETIME
- I wrote this time displaying FLUTTER app, How can I improve it?
- How to convert pandas series to integer for use in datetime.fromisocalendar
- JSON file of 7000 meetings in multiple timezones and Flatlist
- Intl.DateTimeFormat() - return weekday as number?
- I'd like to create a custom time zone converter, any pointers?
- How set weekday datetime?
- ValueError: setting an array element with a sequence. Trying to make a Skymap in Python
- Different X axes with Plotly's make_subplots
- Error when converting datetime from UTC to Brasilia datetime in Power BI
- Problem converting time series df from chr to date using as.POSIXct
- How to supress naive datetime warning in django
- How to find rows that fall within time range from a dataframe?
- Timedelta error - AttributeError: type object 'datetime.datetime' has no attribute 'timedelta'
- How to convert "Tue Feb 27 2024 16:35:30 GMT+0800" String to ZonedDateTime type
- react apex charts x axis labels and tool tip showing different times instead of actual PST time
Related Questions in LOCALIZATION
- Difficulty with hosting Multilingual Wagtail site on alwaysdata
- Android - Localized text search using english alphabet
- Format datetime in java based on locale
- MaterialApp doesn't rebuild after changing locale
- Text overflow in Flutter localization with easy_localization package
- Translate output of function in Swift
- How to handle decimal input values in a globalized MVC app
- Some users facing issues changing app language in Android app
- Does anyone have any idea why my right-to-left (RTL) layout isn't taking effect immediately?
- Delphi 7 application not loading STRINGTABLE resources on Windows 10
- Auto add resources key/value in resx files
- Implementing Multi-language Translation in React Router DOM with i18n for Outlook Add-ins
- Swift Sort string array with german localization
- Account language setting ignored in Wagtail admin for localized model names
- Updating comments with references in .po translation
Related Questions in UTC
- react apex charts x axis labels and tool tip showing different times instead of actual PST time
- Ical.net Serialization Error when serializing 12:00 AM Midnight
- MySQL inserts on March 09th fail due to DST
- Python UTC America/New York Time Conversion
- How to create cronjob such that reminders are triggered as per user timezone?
- How to convert any timestamp of a given timezones into UTC?
- Convert UTC time to local time in nodejs while creating csv
- Mysql UTC format works for "SELECT" but NOT for "UPDATE"
- How could I get hours of each timezone for 2000rows in dataframes
- ngx-daterangepicker displaying wrong value with UTC timezone
- javascript converting datestring to epoch returns three digits too much
- How to convert date without timezone
- Removing "01" Prefix from Timestamps in Plot in Python
- How to convert dates to UTC taking into account winter and summer time?
- Python Arrow datetime function returns a timestamp with seconds field value more than 60
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
There are benefits and drawbacks of each approach.
Server Side
You'll need to know the user's time zone. Usually this is done via user selection on some settings page within your app. Once you know the time zone, conversions usually done with
TimeZoneInfoor with Noda Time, in your MVC controller.You'll need to know the user's culture (ex.
en-USorfr-FR, etc.) to display the correct format (ex.MM/dd/yyyyvsdd/MM/yyyy). This can be done via .NET globalization. The formatting should be done in your MVC view, not the controller.You'll need to stay on top of time zone updates, as time zones rules can change as the governments of the world change their minds about their offsets and DST transition dates.
Client Side
You'll send just the UTC time to the browser, and let it convert to whatever the local time zone is. No need for the user to choose - as long as you only care about their current local time zone.
Getting the formatting right can still be tricky. Libraries like moment.js can help.
There are some bugs that may or may not affect your conversions. Be aware of them.
With regard to your question about the invariant culture - you would need to elaborate on what you mean by "save the date". If you mean storing to a database, such as SQL Server, the culture and format are irrelevant. Send a
DateTimeto your database, not a string.