© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago
fateos

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; }
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

❔ C# Login System Oracle Database
C#CC# / help
3y ago
C# WPF Login Oracle Database
C#CC# / help
3y ago
❔ DateTime Property [Answered]
C#CC# / help
4y ago
Converting a code from C to C#
C#CC# / help
2y ago