Questions tagged [datetimeoffset]

DateTimeOffset is a data structure that encapsulates a DateTime value and the Offset from UTC that the value reflects. It is used to represent an instantaneous moment in time, while still capturing the perspective of the observer.

DateTimeOffset is a data structure that encapsulates a DateTime value and the Offset from UTC that the value reflects. It is used to represent an instantaneous moment in time, while still capturing the perspective of the observer.

Contrary to popular belief (and to much of the documentation) the offset provided does not represent a time zone. One might start with a time zone to obtain the offset, but it is a one-way function. You can not determine the time zone by the offset alone. For a better understanding of this, see this community wiki answer.

The preferred serialization format for this type of data is defined as part of the ISO-8601 specification.

  • Example: 1997-07-16T19:20:30+01:00

DateTimeOffset and similar structures are presented in:

Please update this list if you are aware of similar structures in other languages, frameworks, or databases

614 questions
-1
votes
1 answer

Using linq to return records from sql server based on users datetimeoffset

I have a dateTime offset value that gets passed from the UI which looks like startDate:2022-04-25 21:08:02.2973333 +00:00 but the date i entered is actually the 26th i want to get the records from the db for everything before the 26th and equal to…
deanpillow
  • 121
  • 1
  • 10
-1
votes
1 answer

SQL: Convert GMT timezone to CET

I am querying the following: SELECT "date" FROM "database" and receive the following table: date 2021-03-08 05:05:31+00 2021-03-08 05:10:31+00 The times displayed are in GMT. How can I convert them to CET, taking into account daylight savings?
MathMan 99
  • 665
  • 1
  • 7
  • 19
-1
votes
1 answer

how to Convert UTC timestamp to some other zone timestamp and extract day,daynumber,date,month,year,time,timezone in Java

I am receiving a UTC timestamp "2021-02-11T09:00:00-07:00 --UTC" in a json Object which has to be converted to some other zone timestamp. Once converted to the desired zone timestamp I need to extract day, day number, date, month, year, time,…
-1
votes
1 answer

DateTimeOffset.ToString() formatted output not consistent across enviros

I am formatting a date for integration with Moneris' recurring billing. The request requires a start billing date formatted as "yyyy/MM/dd". Simple task and "it works in Dev". When I publish the API code to our staging environment the submissions…
-1
votes
2 answers

C# Sort / Order DateTimeOffset

Based on my answered question here(C# Sort / Order a textBox with given Values) I have another question. (Thanks to JohnG) I have now written my code to use with values the system gived to me. I don't now why, but the orderby-clause is completly…
anon
-1
votes
1 answer

convert UTC date string to local dateTime

I need to convert UTC dateTime to local I have tried parse but unable to do so? public class Program { static void Main(string[] args) { Console.WriteLine("UTC DateTime Convertor....!"); var giveDateTime =…
K.Z
  • 5,201
  • 25
  • 104
  • 240
-1
votes
2 answers

How to calculate the number of hours between 2 time stamps in military time?

I'm trying to find the number of hours between two time stamps in SQL Server. The data is structured like this: SwipeTime 2019-02-01 18:53:00.740 +0000 RequestDate 2019-02-01 18:45:52.640 -0500 I…
-1
votes
1 answer

Can't convert string to DateTimeOffset

I'm attempting to convert the following string to DateTimeOffset 20201106 13:09:14.510952 +0000 I'm using the following format to attempt to convert it DateTimeOffset dtofResult = new DateTimeOffset(); DateTimeOffset.TryParseExact("20201106…
benbants
  • 590
  • 7
  • 30
-1
votes
1 answer

Date Formatter Issue when parsing date of type "2020-03-30T07:37:02.282+01:00" i have to format in the form today at 12:30 am

I am facing issue while formatting the date and time of the type "2020-03-30T07:37:02.282+01:00" and i am getting date from my server in these two formats "2020-03-30T07:37:02.282+01:00" and “2020-03-30T05:44:02.397Z” I think i am using the correct…
Ankita Singh
  • 304
  • 3
  • 17
-1
votes
1 answer

What is the character length of datetimeoffset datatype in SQL Server / SQL?

Could you please explain how come (YYYY-MM-DD hh:mm:ss {+|-}hh:mm) format is having 26 characters in datetimeoffset datatype in SQL Server? Is there is a space between hh:mm:ss  and {+|-}hh:mm?
-1
votes
1 answer

How to set default DateTimeOffset value in class XmlElement C#

I have following code: public sealed class MyClass { [XmlElement("Remind")] public string lastUpdatedTimeForXml2 { get { return Remind.ToString("yyyy-MM-ddTHH:mm:ss"); } set { Remind = DateTimeOffset.Parse(value); } …
GoOx
  • 73
  • 1
  • 1
  • 9
-1
votes
2 answers

Android timezone issue, confused

I have a date like this Tue Jun 21 14:47:37 GMT+05:30 2016 , which I create myself. I create it using calendar. Where user selects a date and I save it as milliseconds from calendar. When I send it , send it, I again create a calendar instance put…
intellignt_idiot
  • 1,962
  • 2
  • 16
  • 23
-1
votes
2 answers

Comparing a DateTimeOffSet From DataBase to Current Value

What I want to do is simple. If the DateTimeOffSet of a created Event is older than 24 hours I want it removed from the database. I am having a huge amount to trouble working with Converting System.Linq.IQueryable to System.DateTime. Any help will…
-1
votes
1 answer

DateTimeOffset Comparison not working

I am trying to compare DateTimeOffset types. I am checking that the start date is not greater than the end date, but even when the start date is not greater than the end date it fails. I debugged and hovered over this bit of code that is throwing…
allencoded
  • 7,015
  • 17
  • 72
  • 126
-2
votes
1 answer

Regex for DateTimeOffset validation in url?

How to validate the date and time in the url that is the correct DateTimeOffset format? DateTimeOffset format (basically starts with 4 digits of year and end with uppercase Z): yyyy-mm-ddZ yyyy-mm-ddThh:mm:ssZ yyyy-mm-ddThh:mm:ss.fffffZ Valid…
S.P.
  • 369
  • 6
  • 18
1 2 3
40
41