Skip to main content

All Questions

Tagged with
1 vote
6 answers
327 views

What would be a good approach of storing inexact/imprecise dates?

In the application I'm working on, I need to store some metadata which includes dates that can be inexact. As an example, let's say that I want to store the release date of a product. Some examples of ...
Tibi's user avatar
  • 3,845
1 vote
3 answers
89 views

passing a Datetime from SQL to an asp textbox but getting different result

I am passing a DateTime value from SQL Table to a Textbox in ASP.Net using <asp:TextBox ID="dateTxt" runat="server" Text='<%# Eval("date").ToString()%>' class=&...
toly P's user avatar
  • 64
-4 votes
1 answer
726 views

String '12/20/2022 12:00:00 AM' was not recognized as a valid DateTime [closed]

Code & error DateTime dt = DateTime.ParseExact(dgvSP.CurrentRow.Cells[5].Value.ToString(), "dd-MM-YYYY", CultureInfo.InvariantCulture); dtpQLSPnsx.Value = dt; Why my datetimepicker ...
Adudu123's user avatar
0 votes
1 answer
135 views

retrieve date from SQL into C# gridview

I've sql database which is connected to c# windows form in the database there's column with date , data type only date dd/mm/yyyy and the data inside this column is also saved the same I've a gridview ...
Mohamed Rani El Rahaimy's user avatar
0 votes
1 answer
779 views

C# - SQL filter Date two times with Dapper

I want to receive the data of a defined period, using two DateTimes. For that I have the following sql query: public List<Deliveries> GetDeliveriesFilter(DateTime date1, DateTime date2, string ...
Jocelyn's user avatar
  • 153
-5 votes
1 answer
639 views

Store timestamp in format 'DD/MM/YYYY HH24:MI:SS:MS' in Postgres DB

I want to store date & time in my Db in format DD/MM/YYYY HH24:MI:SS:MS. E.g, 15/10/2022 22:42:43:682. But it is actually stored in DB as Oct 15 22:42:43. I couldn't find any relative info except ...
Kanan xalilli's user avatar
-1 votes
1 answer
743 views

How to get datetime format of SQL column in C#?

I want to get format of a datetime column to be able to use it in C#. I want to get it and change my variable to this format. I could not find any solution. How to get it? I just want to be able to ...
Fatih's user avatar
  • 99
1 vote
1 answer
91 views

Should historical SQL UTC Dates change when currently viewing in DST

Let's say I have a date stored in UTC time in SQL using the datetime type. In C#, I am converting to the client using .ToLocalTime(). Will the time value itself be different depending on when I look ...
proggrock's user avatar
  • 3,269
0 votes
1 answer
223 views

C# How to convert the date that have been retrieve from DB and Where should I write?

In this task, I am trying to write a method that filters according to the date entered by the user. But I couldn't figure out where and how to write the format changing code. I have a DateTime object ...
dogac's user avatar
  • 47
0 votes
1 answer
125 views

Linq query not working but its equivalent SQL Server query is working

Following SQL query works fine (Give expected results) in SQL Server. SELECT * FROM ImportedReportDataCRR IRD INNER JOIN ImportedReport IR ON IRD.ImportedReportId = IR.Id WHERE IR.StartDate >= ...
Gulfam's user avatar
  • 578
1 vote
1 answer
331 views

impossible to UPDATE a TimeStamp field in c#

I have fields in my TimeStamp database that I am trying to UPDATE with c# code. But when I UPDATE my table either the fields are null or they have a bad value, but when I UPDATE the float or string ...
Florian ROBERT's user avatar
0 votes
1 answer
468 views

Convert from UTC C# SQL

Using a combination of server-side C#, SQL database, and the dayjs client-side library dayjs I am unable to convert the date stored as UTC in the database UTC to local time. My theory is to store all ...
Brett's user avatar
  • 826
0 votes
1 answer
96 views

Why does casting a SQL MAX(DateTime) command work in SSMS but not in C#? [duplicate]

The following query works as expected in MSSSMS version 18.1 on an Azure hosted SQL database table: select Name, cast(MAX(DTStamp) as Datetime) AS Last_Seen FROM dbo.MyTable GROUP BY Name Example ...
Redgum's user avatar
  • 398
1 vote
2 answers
2k views

ASP.NET MVC Filtering results by date returns 0 results

I am trying to filter the results of a database query by date. The user will input a date value as a string and then I use that string to compare to the date of every query result to try to find a ...
Cole Perry's user avatar
0 votes
2 answers
1k views

SQL : Get the duration between start DateTime and End DateTime from Table entries

I have a SQL table which has entries of machine start and end time (DateTime) with duration of machine running. Given a start DateTime and End DateTime I want to calculate the duration for which ...
Lets Code's user avatar

15 30 50 per page
1
2 3 4 5
27