C# - Oracle DataBase Converting the Date (Oracle) to a c# DateTime Property
How can I replace TO_TIMESTAMP in my select query with the format my c# code uses? I have a class with a gps_timestamp property as a DateTime but it seems it has a Problem Converting the value to a DateTime Property. I don´t know how I can solve this in my select clause. If I do the conversion later (timezone) I would need to go through a lot of gps point and check always if the table also has the right Timezone value (e.x MEZ,BST,..) that would slow down the performance.
string selectGpsInfo = @"
SELECT
gps_gpsid,
gps_latitude,
gps_longitude,
gps_tzname,
CASE
WHEN gps_tzname IS NOT NULL THEN
TO_CHAR(
FROM_TZ(
TO_TIMESTAMP(gps_timestamp, 'YYYY.MM.DD HH24:MI:SS'),
gps_tzname
) AT TIME ZONE SESSIONTIMEZONE,
'YYYY.MM.DD HH24:MI:SS'
)
ELSE
TO_CHAR(
TO_TIMESTAMP(gps_timestamp, 'YYYY.MM.DD HH24:MI:SS'),
'YYYY.MM.DD HH24:MI:SS'
)
END AS gps_timestamp,
c# property in my GPS class:
[FieldnameAttribute("gps_timestamp")]
public DateTime gps_timestamp { get; set; }
0 Replies