Datetime parsed to localTime.
See original GitHub issueWhile passing DateTime object to DataTablesResult.Create method it is parsed to UTC time zone. In order to change it I had to include your whole project to my solution just to change:
static StringTransformers()
{
RegisterFilter<DateTimeOffset>(dateTimeOffset => dateTimeOffset.ToLocalTime().ToString("g"));
RegisterFilter<DateTime>(dateTime => dateTime.ToLocalTime().ToString("g"));
}
to:
static StringTransformers()
{
RegisterFilter<DateTimeOffset>(dateTimeOffset => dateTimeOffset.ToString("g"));
RegisterFilter<DateTime>(dateTime => dateTime.ToString("g"));
}
Is there any better way to do that? I’d like to display exactly this date which is stored in my database. Thanks for any tips.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Parse date time c# with correct timezone and kind
Generally, the Parse method returns a DateTime object whose Kind ... to the time in the local time zone and the Kind is...
Read more >DateTime.Parse Method (System) - Microsoft Learn
The Parse method tries to convert the string representation of a date and time value to its DateTime equivalent. It tries to parse...
Read more >LocalTime parse() method in Java with Examples
In LocalTime class, there are two types of parse() method ... The string must have a valid date-time and is parsed using DateTimeFormatter....
Read more >Java Date Time - LocalTime.parse() Examples - LogicBig
public static LocalTime parse(CharSequence text). Returns the LocalTime instance for the provided text. The text must be valid per DateTimeFormatter.
Read more >How to Convert String to LocalDateTime in Java 8 - Java67
parse () method. It takes a String and a DateTimeFormatter as a parameter. The DateTimeFormatter argument is used to specify the date/time pattern....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It works very well. Thank you very much.
I haven’t had a chance to test this, but you should be able to do this: