datetimeoffset

Is it possible to specify an offset for JSON.NET deserialization of DateTimeOffset?

萝らか妹 提交于 2019-12-08 03:04:00
问题 The following statement prints "1/1/0001 4:00:00 PM -05:00" Console.WriteLine(JsonConvert.DeserializeObject<DateTimeOffset>("\"0001-01-01T16:00:00\"")); This is because when json.net deserializes a DateTime string (which doesn't have an offset) to a DateTimeOffset object, it assigns the local offset, which in this case is -05:00. What if I don't want to use the local offset? Is there any way I can specify an offset to use for this deserialization? (The use case is the database server and the

DateTimeFormatter trouble with a pattern

江枫思渺然 提交于 2019-12-07 10:29:55
问题 I am writing a stock program that (so far) gets the data from "Markit on Demand" through a request such as this: http://dev.markitondemand.com/Api/v2/Quote/xml?symbol=aapl This returns the data in xml, with various measures of the stock (Symbol, name, last price, change, time stamp, etc). I am having trouble creating a DateTimeFormatter in Java 8 to make the timestamp. One example of a timestamp: Fri Jul 18 15:59:00 UTC-04:00 2014 So far the pattern I have is as follows: EEE MMM d HH:mm:ss

using the datetimeoffset datatype with jTDS

北慕城南 提交于 2019-12-07 08:58:59
问题 jTDS currently doesn't support the datetimeoffset datatype introduced in SQL Server 2008. Can anybody suggest if there is a way to use the datetimeoffset type with jTDS? 回答1: As mentioned in the "Backward Compatibility for Down-level Clients" section of the datetimeoffset documentation, we can work with string representations of datetimeoffset values. In fact, if we retrieve a datetimeoffset value with jTDS 1.3.1 we get a java.lang.String value of the form YYYY-MM-DD hh:mm:ss[.nnnnnnn] {+|-

QuickBooks Web Connector TimeModified offset does not account for Daylight Savings time

对着背影说爱祢 提交于 2019-12-07 04:14:04
问题 I'm using QuickBooks Web Connector to pull employee records out of QuickBooks Desktop on a Windows 8.1 machine using QBXML requests. Is there a reason the TimeModified time stamps are returning an offset that does not account for Daylight Savings time? Is there a way to get the current time on the host system? It is currently returning "2014-03-27T14:20:53-05:00" for TimeModified, even though the current timezone is set to Eastern Time with "Adjust for Daylight Savings Time" enabled. The

Is it possible to specify an offset for JSON.NET deserialization of DateTimeOffset?

流过昼夜 提交于 2019-12-06 04:20:18
The following statement prints "1/1/0001 4:00:00 PM -05:00" Console.WriteLine(JsonConvert.DeserializeObject<DateTimeOffset>("\"0001-01-01T16:00:00\"")); This is because when json.net deserializes a DateTime string (which doesn't have an offset) to a DateTimeOffset object, it assigns the local offset, which in this case is -05:00. What if I don't want to use the local offset? Is there any way I can specify an offset to use for this deserialization? (The use case is the database server and the web server are in different time zones, and I need the incoming requests that have zone-unspecified

Mapping DateTimeOffset to TIMESTAMP WITH TIME ZONE in Oracle & NHibernate

落花浮王杯 提交于 2019-12-06 03:10:02
I can't make NHibernate successfully map the native oracle "TIMESTAMP WITH TIME ZONE" type to the CLR DateTimeOffset type. It seems that Oracle chose to completely ignore the native DateTimeOffset type and is using their own proprietary type (OracleTimeStampTZ) in their ADO.NET provider. Since NHibernate is using native CLR types (like the DateTimeOffset type) - the Oracle ADO.NET provider fails any attempt to insert a row with such a type. Do any of you have an idea how this issue can be solved ? I have to use the DateTimeOffset type since I need to record the timezone/daylight-saving offset

How many days to add for “semi-monthly”

故事扮演 提交于 2019-12-06 02:13:44
问题 I have a enum type called PaymentFrequency whose values indicate how many payments per year are being made... So I have public enum PaymentFrequency { None = 0, Annually = 1, SemiAnnually = 2, EveryFourthMonth = 3, Quarterly = 4, BiMonthly = 6, Monthly = 12, EveryFourthWeek = 13, SemiMonthly = 24, BiWeekly = 26, Weekly = 52 } Based on NumberOfPayments , PaymentFrequency , and FirstPaymentDate (of type DateTimeOffset) I want to calculate LastPaymentDate . But I am having issue figuring out how

Storing a c# DateTimeOffset value in a SQL Server 2005 database

萝らか妹 提交于 2019-12-05 11:21:05
I want to store a a c# DateTimeOffset value in a SQL Server 2005 database. Sql 2008 has this as a built-in-type, but SQL Server 2005 does not. The DateTimeOffset structure has a DateTime value wich I store as DateTime, an an Offset property (of type TimeSpan). Since this is the time zone relative to UTC, presumably it is usally at a whole number of hours or half-hours. Suggestions on how best to store this in a SQL Server 2005 database? It's not a good idea to assume that an offset is a number of hours or half-hours - there are certainly quarter-hour timezones around. Using milliseconds for

QuickBooks Web Connector TimeModified offset does not account for Daylight Savings time

送分小仙女□ 提交于 2019-12-05 08:44:26
I'm using QuickBooks Web Connector to pull employee records out of QuickBooks Desktop on a Windows 8.1 machine using QBXML requests. Is there a reason the TimeModified time stamps are returning an offset that does not account for Daylight Savings time? Is there a way to get the current time on the host system? It is currently returning "2014-03-27T14:20:53-05:00" for TimeModified, even though the current timezone is set to Eastern Time with "Adjust for Daylight Savings Time" enabled. The offset should be -04:00. The QBXML request: <?xml version="1.0" encoding="utf-8"?> <?qbxml version="12.0"?>

Converting DateTime.MinValue to DateTimeOffset

 ̄綄美尐妖づ 提交于 2019-12-05 07:08:21
I am trying to convert DateTime.MinValue to a DateTimeOffset value but am getting an ArgumentOutOfRange exception. I was looking at the the MSDN article on implicit conversions of DateTime to DateTimeOffset and the Exception section states that I'll receive this ArgumentOutOfRange exception when; ... The Coordinated Universal Time (UTC) date and time that results from applying the offset is earlier than MinValue. ... Why then does the following code throw the exception; DateTime test = DateTime.MinValue; DateTimeOffset dto = test; Is it simply due to my timezone? I am in GMT +8, but my