datetimeoffset

How do I Increment an NSDate object in Objective-C

自闭症网瘾萝莉.ら 提交于 2020-01-03 10:19:26
问题 I want to take the next day by giving the current date The code i used as follows +(NSDate *)getForDays:(int)days fromDate:(NSDate *) date { NSTimeInterval secondsPerDay = 24 * 60 * 60 * days; return [date addTimeInterval:secondsPerDay]; } this works fine but when the daylight saving enabled this leads to errors. How can I make this work when daylight saving is enabled. 回答1: As you have found, what you have now is pretty error-prone. Not only can it trip up over a daylight savings change, but

How do I Increment an NSDate object in Objective-C

余生颓废 提交于 2020-01-03 10:18:09
问题 I want to take the next day by giving the current date The code i used as follows +(NSDate *)getForDays:(int)days fromDate:(NSDate *) date { NSTimeInterval secondsPerDay = 24 * 60 * 60 * days; return [date addTimeInterval:secondsPerDay]; } this works fine but when the daylight saving enabled this leads to errors. How can I make this work when daylight saving is enabled. 回答1: As you have found, what you have now is pretty error-prone. Not only can it trip up over a daylight savings change, but

How to compare two DateTimeOffSet?

你离开我真会死。 提交于 2020-01-03 08:47:46
问题 I have a variable which is of type DateTimeOffSet. I'd like to filter all the projectS that were created after January 1st, 2010. So I've wrote the following query: var _date = new DateTimeOffset(2010, 01, 01, 0, 0, 0, new TimeSpan(-7, 0, 0)); var projects = _repository.Find<Project> (x => x.CompanyId = CompId && x.CreatedOn > _date) .ToList(); But when I look at the database, those are the type of values I see: 2001-01-25 05:21:46.4370000 -08:00 2005-06-17 00:00:00.0000000 -07:00 Clearly,

Changing current user timezone based on server UTC offset and user UTC offset

江枫思渺然 提交于 2020-01-01 05:50:09
问题 im writing a twitter web service in php. When a user signs in, i receive this node: <utc_offset>-18000</utc_offset> I have to change the script's timezone so that it adapts to the user's real timezone. The only php function i have found for this is: date_default_timezone_set($timezone_identifier) but it won't let me use -18000 as a the $timezone_identifier parameter. So, how can i change the current user timezone based on two values: Server UTC offset and User UTC offset BTW, this is how i'm

IST to EST Time Conversion In Java

偶尔善良 提交于 2019-12-31 05:12:09
问题 I have a Date field in Java in IST Time. I want to convert the same to EST Time and the output should be as a Date Type only. I am able to accomplish the same using the below piece of code:- SimpleDateFormat dateTimeFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); dateTimeFormat.setTimeZone(TimeZone.getTimeZone("Asia/Calcutta")); Date date = new Date(); DateFormat timeFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); timeFormat.setTimeZone(TimeZone.getTimeZone("America/New_York"));

Basic PHP timezones conversion

落花浮王杯 提交于 2019-12-25 02:46:56
问题 I have looked at previous questions and nothing seems to fit what I require. I am working on a scheduling system and now the client wants to add timezones. So basically I need to be able to proform an action at a specific date and time. Lets say someone chooses to have an alert at the following date/time: 25-12-2010 13:01:00 + / - their timezone I need to be able to store this in mysql as an unix_timestamp, I have been looking at PHP's DateTime and DateTimeZone but this has confused me more.

Pandas Custom Business Day Calendar Offset

99封情书 提交于 2019-12-24 11:10:03
问题 'This is a basic question that I can't seem to find addressed anywhere. I understand how to make a custom business day calendar per the pandas documentation. However, I have a datetime index that is already created and is 'customized'. It is a date range with particular dates eliminated: custom_datelist: 2003-01-02 2003-01-03 2003-01-05 2003-01-06 2003-01-09 ... So, with this calendar, how do I create a date offset? The documentation indicates how to generate the date series but it isn't

DateTimeOffset resolution in c# and SQL Server

筅森魡賤 提交于 2019-12-23 09:50:04
问题 Docs state that in both .NET and SQL server the resolution is 100ns. The time component of a DateTimeOffset value is measured in 100-nanosecond units called ticks - C# Accuracy - 100 nanoseconds - SQL Server However SQL seems to drop the last digit (e.g. I'm trying to save 2013-08-15 09:19:07.2459675 -04:00, and SQL saves 2013-08-15 09:19:07.2459670 -04:00 - notice the last digit changes.) This happens on a same machine, so its not hardware dependent. Not that I actually need this resolution,

Mapping DateTimeOffset to TIMESTAMP WITH TIME ZONE in Oracle & NHibernate

回眸只為那壹抹淺笑 提交于 2019-12-22 10:58:12
问题 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

Json.Net messes up timezones for DateTimeOffset when serializing

房东的猫 提交于 2019-12-22 08:33:59
问题 I have looked at a lot of related questions but none of them seem to be working for me. I'm trying to serialize everything in UTC. Here's my code: class Class1 { static void Main() { Class2 foo = new Class2(); JObject json = JObject.Parse(JsonConvert.SerializeObject(foo, new JsonSerializerSettings() { DateParseHandling = DateParseHandling.DateTimeOffset, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc })); Console.WriteLine(json.ToString(