ASP.NET – Store dates hours in the database?

I’m writing a blog and want to display my posts in Eastern Time Zone. I think storing all UTC is the right way. This will bring some challenges:

>I have to convert all time from UTC to Eastern. This is not a big problem, but a lot of code has been added.
>And “biggie” is that I use short date and time to quote by passing query, ala blog Post. The problem is that there is no way to convert the short date time to the correct UTC date because I am missing the time information for the publication.

Well, is there any problem with storing all dates in Eastern Time? This will definitely make the rest of the application easier, but if I need to change the time zone, everything will be stored incorrectly.

Update

@Jon, take your profession very seriously Knowledge, but I have decided that it is wrong to store UTC time in the database. But you might convince me!

So, let me give you a complete weight loss. I will convert all time to UTC, which requires adding more “syntax” in the declaration section of the code.

I What is being coded is a blog, so I have 2 routes, a list route and a detailed route. The detailed information route requires a shorter date, and the name of the post is assumed to be unique in combination. This is why it crashes. I am querying Pass the short-circuit line in the middle.

Depending on the time, we can wrap it to make it 29 or 30. So the short date must be correct because I don’t have enough information in the query to determine how to Eastern time is converted back to UTC.

I stored a DatePosted “short date”, all times are @12 AM for SQL purposes and FirstModified long dates. So, I said, no problem, I just Store short dates in Eastern, and then convert long dates to Eastern. No, because I can’t make these queries work.

So, I think I’m wrong. Dates should always be stored in Eastern time (I think The time to use). Then, if the user wants to change the time zone (not required), we just need to browse all entries and make changes.

Maybe, I am thinking about this error, but in my case , Only the Eastern Time Zone is used, so it’s a waste of time anyway.

I look forward to any comments on this!

Key question:

>I passed a short date in the query. If the short date is UTC, then the date in the query may be closed. 1. If I set the short date The date is passed as Oriental, then I will need a linq-to-sql syntax that can be converted to SQL, which will allow me to compare dates in different time zones.

Thank you again for your help!

It’s just a blog, not a commercial web application used by offices around the world, so I Say continue to use Eastern Time.

If you have changed the time zone and want to display the new time zone, a SQL update statement can always update to the new zone.

p>

I am writing a blog and want to display my posts in Eastern Time Zone. I think storing all UTC is the right way. This will bring some challenges:

>I must Convert all time from UTC to Eastern. This is not a big problem, but a lot of code has been added.
>And “biggie” is that I use short date and time to cite the post by passing the query, ala blog. The problem is that there is no way Convert the short date time to the correct UTC date because I am missing the published time information.

Well, is there any problem with storing all dates in Eastern Time? This will definitely make the rest of the application easier, but if I need to change the time zone, everything will be stored incorrectly.

Update

@Jon, take your profession very seriously Knowledge, but I have decided that it is wrong to store UTC time in the database. But you might convince me!

So, let me give you a complete weight loss. I will convert all time to UTC, which requires adding more “syntax” in the declaration section of the code.

I What is being coded is a blog, so I have 2 routes, a list route and a detailed route. The detailed information route requires a shorter date, and the name of the post is assumed to be unique in combination. This is why it crashes. I am querying Pass the short-circuit line in the middle.

Depending on the time, we can wrap it to make it 29 or 30. So the short date must be correct because I don’t have enough information in the query to determine how to Eastern time is converted back to UTC.

I stored a DatePosted “short date”, all times are @12 AM for SQL purposes and FirstModified long dates. So, I said, no problem, I just Store short dates in Eastern, and then convert long dates to Eastern. No, because I can’t make these queries work.

So, I think I’m wrong. Dates should always be stored in Eastern time (I think The time to be used). Then, if the user wants to change the time zone (not required), we just need to browse all entries and make changes.

Maybe, I am thinking about this error, but in my case , Only the Eastern Time Zone is used, so it’s a waste of time anyway.

I look forward to any comments on this!

Key question:

>I passed a short date in the query. If the short date is UTC, then the date in the query may be closed. 1. If I set the short date The date is passed as Oriental, then I will need a linq-to-sql syntax that can be converted to SQL, which will allow me to compare dates in different time zones.

Thank you again for your help!

It is just a blog, not a commercial web application used by offices around the world, so I said to continue to use Eastern Time.

If you have changed the time zone and want to display the new time zone, a SQL update statement can always be updated to the new zone.

Leave a Comment

Your email address will not be published.