Search Results

Search found 835 results on 34 pages for 'utc'.

Page 2/34 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Storing DateTime (UTC) vs. storing DateTimeOffset

    - by Frederico
    I usually have an "interceptor" that right before reading/writing from/to the database does datetime conversion (from UTC to localtime, and from localtime to utc), so I can use DateTime.Now (derivations and comparisions) throughout the system without worrying about timezones. Regarding serialization and moving data between computers, there is no need to bother, as the datetime is always UTC. Should I continue storing my dates (SQL 2008 - datetime) in UTC format or should I instead store it using DateTimeOffset (SQL 2008 - datetimeoffset)? UTC Dates in the database (datetime type) have been working and known for so long, why change it? What are the advantages? I have already looked into articles like this one, but I'm not 100% convinced though. Any thoughts?

    Read the article

  • Subroutine to apply Daylight Bias to display time in local DST?

    - by vfclists
    UK is currently 1 hour ahead of UTC due to Daylight Savings Time. When I check the Daylight Bias value from GetTimeZoneInformation it is currently -60. Does that mean that translating UTC to DST means DST = UTC + -1 * DaylightBias, ie negate and add? I thought in this case for instance adding Daylight Bias to UTC is the correct operation, hence requiring DaylightBias to be 60 rather than -60.

    Read the article

  • TimeZone change to UTC while updating the Appointment

    - by Firoz Ansari
    I am using EWS 1.2 to send appointments. On creating new Appointments, TimeZone is showing properly on notification mail, but on updating the same appointment, it's TimeZone reset to UTC. Could anyone help me to fix this issue? Here is sample code to replicate the issue: ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")); service.Credentials = new WebCredentials("ews_calendar", PASSWORD, "acme"); service.Url = new Uri("https://acme.com/EWS/Exchange.asmx"); Appointment newAppointment = new Appointment(service); newAppointment.Subject = "Test Subject"; newAppointment.Body = "Test Body"; newAppointment.Start = new DateTime(2012, 03, 27, 17, 00, 0); newAppointment.End = newAppointment.Start.AddMinutes(30); newAppointment.RequiredAttendees.Add("[email protected]"); //Attendees get notification mail for this appointment using (UTC-05:00) Eastern Time (US & Canada) timezone //Here is the notification content received by attendees: //When: Tuesday, March 27, 2012 5:00 PM-5:30 PM. (UTC-05:00) Eastern Time (US & Canada) newAppointment.Save(SendInvitationsMode.SendToAllAndSaveCopy); // Pull existing appointment string itemId = newAppointment.Id.ToString(); Appointment existingAppointment = Appointment.Bind(service, new ItemId(itemId)); //Attendees get notification mail for this appointment using UTC timezone //Here is the notification content received by attendees: //When: Tuesday, March 27, 2012 11:00 PM-11:30 PM. UTC existingAppointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy);

    Read the article

  • Does anyone know how to appropriately deal with user timezones in rails 2.3?

    - by Amazing Jay
    We're building a rails app that needs to display dates (and more importantly, calculate them) in multiple timezones. Can anyone point me towards how to work with user timezones in rails 2.3(.5 or .8) The most inclusive article I've seen detailing how user time zones are supposed to work is here: http://wiki.rubyonrails.org/howtos/time-zones... although it is unclear when this was written or for what version of rails. Specifically it states that: "Time.zone - The time zone that is actually used for display purposes. This may be set manually to override config.time_zone on a per-request basis." Keys terms being "display purposes" and "per-request basis". Locally on my machine, this is true. However on production, neither are true. Setting Time.zone persists past the end of the request (to all subsequent requests) and also affects the way AR saves to the DB (basically treating any date as if it were already in UTC even when its not), thus saving completely inappropriate values. We run Ruby Enterprise Edition on production with passenger. If this is my problem, do we need to switch to JRuby or something else? To illustrate the problem I put the following actions in my ApplicationController right now: def test p_time = Time.now.utc s_time = Time.utc(p_time.year, p_time.month, p_time.day, p_time.hour) logger.error "TIME.ZONE" + Time.zone.inspect logger.error ENV['TZ'].inspect logger.error p_time.inspect logger.error s_time.inspect jl = JunkLead.create! jl.date_at = s_time logger.error s_time.inspect logger.error jl.date_at.inspect jl.save! logger.error s_time.inspect logger.error jl.date_at.inspect render :nothing => true, :status => 200 end def test2 Time.zone = 'Mountain Time (US & Canada)' logger.error "TIME.ZONE" + Time.zone.inspect logger.error ENV['TZ'].inspect render :nothing => true, :status => 200 end def test3 Time.zone = 'UTC' logger.error "TIME.ZONE" + Time.zone.inspect logger.error ENV['TZ'].inspect render :nothing => true, :status => 200 end and they yield the following: Processing ApplicationController#test (for 98.202.196.203 at 2010-12-24 22:15:50) [GET] TIME.ZONE#<ActiveSupport::TimeZone:0x2c57a68 @tzinfo=#<TZInfo::DataTimezone: Etc/UTC>, @name="UTC", @utc_offset=0> nil Fri Dec 24 22:15:50 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 22:00:00 UTC +00:00 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 22:00:00 UTC +00:00 Completed in 21ms (View: 0, DB: 4) | 200 OK [http://www.dealsthatmatter.com/test] Processing ApplicationController#test2 (for 98.202.196.203 at 2010-12-24 22:15:53) [GET] TIME.ZONE#<ActiveSupport::TimeZone:0x2c580a8 @tzinfo=#<TZInfo::DataTimezone: America/Denver>, @name="Mountain Time (US & Canada)", @utc_offset=-25200> nil Completed in 143ms (View: 1, DB: 3) | 200 OK [http://www.dealsthatmatter.com/test2] Processing ApplicationController#test (for 98.202.196.203 at 2010-12-24 22:15:59) [GET] TIME.ZONE#<ActiveSupport::TimeZone:0x2c580a8 @tzinfo=#<TZInfo::DataTimezone: America/Denver>, @name="Mountain Time (US & Canada)", @utc_offset=-25200> nil Fri Dec 24 22:15:59 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 15:00:00 MST -07:00 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 15:00:00 MST -07:00 Completed in 20ms (View: 0, DB: 4) | 200 OK [http://www.dealsthatmatter.com/test] Processing ApplicationController#test3 (for 98.202.196.203 at 2010-12-24 22:16:03) [GET] TIME.ZONE#<ActiveSupport::TimeZone:0x2c57a68 @tzinfo=#<TZInfo::DataTimezone: Etc/UTC>, @name="UTC", @utc_offset=0> nil Completed in 17ms (View: 0, DB: 2) | 200 OK [http://www.dealsthatmatter.com/test3] Processing ApplicationController#test (for 98.202.196.203 at 2010-12-24 22:16:04) [GET] TIME.ZONE#<ActiveSupport::TimeZone:0x2c57a68 @tzinfo=#<TZInfo::DataTimezone: Etc/UTC>, @name="UTC", @utc_offset=0> nil Fri Dec 24 22:16:05 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 22:00:00 UTC +00:00 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 22:00:00 UTC +00:00 Completed in 151ms (View: 0, DB: 4) | 200 OK [http://www.dealsthatmatter.com/test] It should be clear above that the 2nd call to /test shows Time.zone set to Mountain, even though it shouldn't. Additionally, checking the database reveals that the test action when run after test2 saved a JunkLead record with a date of 2010-12-22 15:00:00, which is clearly wrong.

    Read the article

  • How do I get Java to parse and format a date/time with the same time zone? I keep getting the local timezone

    - by fishtoprecords
    My application keeps all Java Date's in UTC. Parsing them is easy, but when I print them out, the display shows the computer's local time zone, and I want to show it as UTC. Example code: String sample = "271210 200157 UTC"; SimpleDateFormat dfmt = new SimpleDateFormat("ddMMyy HHmmss Z"); Date result = dfmt.parse(sample); System.out.printf("%tc\n", result); the result is Mon Dec 27 15:01:57 EST 2010 What I want is Mon Dec 27 20:01:57 UTC 2010 Clearly I have to set some Locale and TimeZone values, but I don't see where to put them. Thanks Pat

    Read the article

  • javascript date.utc problem

    - by Dave
    I'm trying to compare 2 dates using javascript. 1 at the end of the month and 1 at the beginning. I need to compare these 2 dates in seconds so I'm using the Date.UTC javascript function. Here's the code: var d = Date.UTC(2010,5,31,23,59,59); document.write(d); var d2 = Date.UTC(2010,6,1,12,20,11); document.write(d2); The output for is: 1278028799000 1277986811000 This is telling me that 1/6/2010 is less than 5/31/2010 in milliseconds. How is that possible? What am I doing wrong? Thanks for your help.

    Read the article

  • Convert UTC DateTime to another Time Zone

    - by Mark Richman
    I have a UTC DateTime value coming from a database record. I also have a user-specified time zone (an instance of TimeZoneInfo). How do I convert that UTC DateTime to the user's local time zone? Also, how do I determine if the user-specified time zone is currently observing DST? I'm using .NET 3.5. Thanks, Mark

    Read the article

  • UTC time stamp on Windows

    - by Arman
    I have a buffer with the UTC time stamp in C, I broadcast that buffer after every ten seconds. The problem is that the time difference between two packets is not consistent. After 5 to 10 iterations the time difference becomes 9, 11 and then again 10. Kindly help me to sort out this problem. I am using <time.h> for UTC time.

    Read the article

  • Java ResultSet how to getTimeStamp in UTC

    - by mkal
    The database has data in UTC and when I try to get data java.util.Calendar cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getTimeZone("UTC")); java.sql.Timestamp ts = resultSet.getTimestamp(PUBLISH_TIME); cal.setTime(ts); Is there anything wrong with this?

    Read the article

  • converting a UTC time to a local time zone in Java

    - by aloo
    I know this subject has been beaten to death but after searching for a few hours to this problem I had to ask. My Problem: do calculations on dates on a server based on the current time zone of a client app (iphone). The client app tells the server, in seconds, how far away its time zone is away from GMT. I would like to then use this information to do computation on dates in the server. The dates on the server are all stored as UTC time. So I would like to get the HOUR of a UTC Date object after it has been converted to this local time zone. My current attempt: int hours = (int) Math.floor(secondsFromGMT / (60.0 * 60.0)); int mins = (int) Math.floor((secondsFromGMT - (hours * 60.0 * 60.0)) / 60.0); String sign = hours > 0 ? "+" : "-"; Calendar now = Calendar.getInstance(); TimeZone t = TimeZone.getTimeZone("GMT" + sign + hours + ":" + mins); now.setTimeZone(t); now.setTime(someDateTimeObject); int hourOfDay = now.get(Calendar.HOUR_OF_DAY); The variables hour and mins represent the hour and mins the local time zone is away from GMT. After debugging this code - the variables hour, mins and sign are correct. The problem is hourOfDay does not return the correct hour - it is returning the hour as of UTC time and not local time. Ideas?

    Read the article

  • Get Rails to save a record to the database in a non-UTC time

    - by Shaun
    Is there a way to get Rails to save records to the database without it automagically converting the timestamp into UTC before saving? The problem is that I have a few models that pull data from a legacy database that saves everything in Mountain Time and occasionally I have to have my Rails app write to that database. The problem is that every time it does, it converts the time I give it from Mountain Time to UTC, which is 6-7 hours ahead (depending on DST)! Needless to say, this really messes with reporting on that database. If I could get around doing this, I would. Unfortunately, I can't do anything about the fact that this other database uses a different timezone, nor can I really get away from the need for this app to save to that database occasionally. If I could just get Rails to stop trying to help me, it'd be great.

    Read the article

  • UTC date and time

    - by klaus-vlad
    Hi, How can I obtain the current UTC time and date using a gps location changed lsitener ? public void onLocationChanged(Location lastLocation) { lastLocation.getTime() }

    Read the article

  • Autodetect timezone in Rails given UTC offset and DST

    - by Jose
    I basically want to autodetect a user's timezone using Rails. I can use this JS code at the user's browser (http://www.onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/) to send a form with the UTC offset and the fact that the time zone observes DST during summer or not, in the user's time zone. Once I have that info in the server, I want to select the matching time zone. In Rails, I can get a list of time zones with ActiveSupport::TimeZone.all. Also, I can filter zones by utf offset thanks to the utc_offset method. However, I don't know how to filter the timezones that do/don't observe DST. E.g. suppose a user lives in Amsterdam. Filtering by UTC offset will return Berlin, Belgrado, Madrid, etc timezones, as well as West Central Africa. All of them, but West Central Africa, would be appropriate timezones for a user in Amsterdam (as they provide the same time/date), but I need to filter West Central Africa, which does not perform DST in summer. How can I do this in Rails? Also, are any of my assumptions wrong?

    Read the article

  • How is timezone handled in the lifecycle of an ADO.NET + SQL Server DateTime column?

    - by stimpy77
    Using SQL Server 2008. This is a really junior question and I could really use some elaborate information, but the information on Google seems to dance around the topic quite a bit and it would be nice if there was some detailed elaboration on how this works... Let's say I have a datetime column and in ADO.NET I set it to DateTime.UtcNow. 1) Does SQL Server store DateTime.UtcNow accordingly, or does it offset it again based on the timezone of where the server is installed, and then return it offset-reversed when queried? I think I know that the answer is "of course it stores it without offsetting it again" but want to be certain. So then I query for it and cast it from, say, an IDataReader column to a DateTime. As far as I know, System.DateTime has metadata that internally tracks whether it is a UTC DateTime or it is an offsetted DateTime, which may or may not cause .ToLocalTime() and .ToUniversalTime() to have different behavior depending on this state. So, 2) Does this casted System.DateTime object already know that it is a UTC DateTime instance, or does it assume that it has been offset? Now let's say I don't use UtcNow, I use DateTime.Now, when performing an ADO.NET INSERT or UPDATE. 3) Does ADO.NET pass the offset to SQL Server and does SQL Server store DateTime.Now with the offset metadata? So then I query for it and cast it from, say, an IDataReader column to a DateTime. 4) Does this casted System.DateTime object already know that it is an offset time, or does it assume that it is UTC?

    Read the article

  • How to convert a UTC date to NSDate?

    - by Sheehan Alam
    I have a string that is UTC and would like to convert it to an NSDate. static NSDateFormatter* _twitter_dateFormatter; [_twitter_dateFormatter setFormatterBehavior:NSDateFormatterBehaviorDefault]; [_twitter_dateFormatter setDateFormat:@"EEE MMM dd HH:mm:ss ZZZ yyyy"]; [_twitter_dateFormatter setLocale:_en_us_locale]; NSDate *d = [_twitter_dateFormatter dateFromString:sDate]; When I go through the debugger *d is nil even though sDate is "2010-03-24T02:35:57Z" Not exactly sure what I'm doing wrong.

    Read the article

  • How to convert long timestamp to UTC timestamp on Objective C

    - by David
    Hey I had a iphone app, the code has a method to retrieve current time stamp from iphone and upload to server. Here is my code: long long timestampMillis = (long long)([[NSDate date] timeIntervalSince1970] * 1000); However, one of customer use the app in Japan sent data shown on server is tomorrow time. How can I retrieve UTC timestamp? Thanks advanced

    Read the article

  • Converting local timestamp to UTC timestamp in Java.

    - by fiXedd
    I have a milliseconds-since-local-epoch timestamp that I'd like to convert into a milliseconds-since-UTC-epoch timestamp. From a quick glance through the docs it looks like something like this would work: int offset = TimeZone.getDefault().getRawOffset(); long newTime = oldTime - offset; Is there a better way to do this?

    Read the article

  • Need to incorporate Timezone Selection (UTC) within Web App

    - by tonsils
    Hi, I need to incorporate a Timezone dropdown selection within my web app, which I need to use within an Oracle database. I basically require the user to select their timezone and I then need to use this against time stamp info stored within the Oracle tables. Unsure where/how to build this Timezone selection list within my page - example how-tos would be great. Would like this to be UTC. Thanks.

    Read the article

  • Linq to SQL DateTime values are local (Kind=Unspecified) - How do I make it UTC?

    - by ericsson007
    Isn't there a (simple) way to tell Linq To SQL classes that a particular DateTime property should be considered as UTC (i.e. having the Kind property of the DateTime type to be Utc by default), or is there a 'clean' workaround? The time zone on my app-server is not the same as the SQL 2005 Server (cannot change any), and none is UTC. When I persist a property of type DateTime to the dB I use the UTC value (so the value in the db column is UTC), but when I read the values back (using Linq To SQL) I get the .Kind property of the DateTime value to be 'Unspecified'. The problem is that when I 'convert' it to UTC it is 4 hours off. This also means that when it is serialized it it ends up on the client side with a 4 hour wrong offset (since it is serialized using the UTC).

    Read the article

  • Python datetime not including DST when using pytz timezone

    - by Jesper
    If I convert a UTC datetime to swedish format, summertime is included (CEST). However, while creating a datetime with sweden as the timezone, it gets CET instead of CEST. Why is this? >>> # Modified for readability >>> import pytz >>> import datetime >>> sweden = pytz.timezone('Europe/Stockholm') >>> >>> datetime.datetime(2010, 4, 20, 16, 20, tzinfo=pytz.utc).astimezone(sweden) datetime(2010, 4, 20, 18, 20, tzinfo=<... 'Europe/Stockholm' CEST+2:00:00 DST>) >>> >>> datetime.datetime(2010, 4, 20, 18, 20, tzinfo=sweden) datetime(2010, 4, 20, 18, 20, tzinfo=<... 'Europe/Stockholm' CET+1:00:00 STD>) >>>

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >