SQL Server Verwendung Datentyp time(7)
Wie wird ein SQL Server Datentyp Time(7) in der Ausgabe
dargestellt
->
Darstellung einer SQL-Server Datentyp time wird zu TimeSpan
in C# und in JSON zu Datenarray aus ticks, days, hours Minuts wie java Calendar
SQL Server
In SQL Server der Datentyp time(7)
[tmStart]
[time](7) NULL,
[tmEnd]
[time](7) NULL,
|
Asp.Net
Model
Wird in Asp.Net Core API als TimeSpan ausgwertet
public TimeSpan? TmStart { get; set; }
public TimeSpan? TmEnd { get; set; }
|
JSon
In der JSON Ausgabe oder auch in Excel
"tmStart": {
"ticks": 385200000000,
"days": 0,
"hours": 10,
"milliseconds": 0,
"minutes": 42,
"seconds": 0,
"totalDays": 0.44583333333333336,
"totalHours": 10.7,
"totalMilliseconds": 38520000,
"totalMinutes": 642,
"totalSeconds":
38520
},
|
Darstellung einer SQL-Server Datentyp time wird zu TimeSpan
in C# und in JSON zu Datenarray aus ticks, days, hours Minuts wie java Calendar
In Design
View Table
Und als Daten in der Tabelle als Eingabe
CREATE TABLE [dbo].[TimeRecords](
[IDTimeRecord] [int] IDENTITY(1,1) NOT NULL,
[dtDate] [date] NULL,
[tmStart]
[time](7) NULL,
[tmEnd] [time](7) NULL,
[Project] [nvarchar](255) NULL,
[Details] [nvarchar](max) NULL,
[IDUserGuid]
[nvarchar](450) NULL,
[dtEdit] [datetime] NULL,
|
Model
Unter ASP.Net
Core Model, ASP.Net
Core
using System;
using System.Collections.Generic;
#nullable disable
namespace APITimerecord.Models
{
public partial class TimeRecord
{
public int IdtimeRecord { get; set; }
public DateTime? DtDate { get; set; }
public
TimeSpan? TmStart { get; set; }
public TimeSpan? TmEnd { get; set; }
public string Project { get; set; }
public string Details { get; set; }
public string IduserGuid { get; set; }
public DateTime? DtEdit { get; set; }
}
}
|
JSON
Als JSON Datenausgabe in einer Web API
{
"idtimeRecord": 1,
"dtDate": "2021-01-21T00:00:00",
"tmStart": {
"ticks": 385200000000,
"days": 0,
"hours": 10,
"milliseconds": 0,
"minutes": 42,
"seconds": 0,
"totalDays": 0.44583333333333336,
"totalHours": 10.7,
"totalMilliseconds": 38520000,
"totalMinutes": 642,
"totalSeconds": 38520
},
|
Excel
Und in Excel als Spalte aus Daten aus Web
Name
|
Value
|
ticks
|
3,852E+11
|
days
|
0
|
hours
|
10
|
milliseconds
|
0
|
minutes
|
42
|
seconds
|
0
|
totalDays
|
0,445833333
|
totalHours
|
10,7
|
totalMilliseconds
|
38520000
|
totalMinutes
|
642
|
totalSeconds
|
38520
|