Все вопросы: [utc]

57 вопросов

похожие теги:
12
голосов
2ответов
11933 просмотров

How can I get an accurate UTC time with Python?

I wrote a desktop application and was using datetime.datetime.utcnow() for timestamping, however I've recently noticed that some people using the application get wildly different results than I do when we run the program at the same time. Is there any way to get the UTC time locally without usin...

6
голосов
3ответов
11043 просмотров

Convert UTC string to TDatetime in Delphi

var tm : string; dt : tdatetime; tm := '2009-08-21T09:11:21Z'; dt := ? I know I can parse it manually but I wonder if there is any built-in function or Win32 API function to do this ?

13
голосов
4ответов
52876 просмотров

Convert to UTC Timestamp

//parses some string into that format. datetime1 = datetime.strptime(somestring, "%Y-%m-%dT%H:%M:%S") //gets the seconds from the above date. timestamp1 = time.mktime(datetime1.timetuple()) //adds milliseconds to the above seconds. timeInMillis = int(timestamp1) * 1000 How do I (at any point ...

1
голосов
2ответов
5444 просмотров

javascript conversion of yyyy-mm-dd hh:mm:ss aa help

can anybody spot any mistake in this function? .. This is a function which receives a string of type yyyy-mm-dd hh:mm:ss aa and converts to UTC and builds up a string yyyy-mm-dd hh:mm:ss. function LocalTimetoUTC(localTime) { var time = localTime.split(" "); //Received :- yyyy-mm-dd hh:mm:ss...

6
голосов
3ответов
14664 просмотров

Boost C++ date_time microsec_clock and second_clock

I discovered a strange result in Boost C++ date time library. There is inconsistency between microsec_clock and second_clock, and I don't understand why is that. I am using Windows XP 32-bits My snip of code: using namespace boost::posix_time; ... ptime now = second_clock::universal_time(); std...

18
голосов
3ответов
5736 просмотров

Rehydrating fluent nhibernate configured DateTime as Kind Utc rather than Unspecified

Is there a way in fluent nhibernate to map a DateTime to rehydrate my entity with DateTime.Kind set to Utc rather than unspecified? I'm currently persisting a DateTime that is Utc, but the Kind coming back is always Unspecified, throwing off my time.

98
голосов
16ответов
105622 просмотров

JSON Stringify changes time of date because of UTC

My date objects in JavaScript are always represented by UTC +2 because of where I am located. Hence like this Mon Sep 28 10:00:00 UTC+0200 2009 Problem is doing a JSON.stringify converts the above date to 2009-09-28T08:00:00Z (notice 2 hours missing i.e. 8 instead of 10) What I need is fo...

7
голосов
4ответов
9630 просмотров

How to I accurately get current UTC time via strtotime?

In PHP, how do I get the current time, in UTC, without hard coding knowledge of where my hosting provider is? For example, I tried the following: time() + strtotime('January 1, 2000')-strtotime('January 1, 2000 UTC') and find that it reports a time that is one hour ahead of actual UTC time. ...

0
голосов
2ответов
122 просмотров

rails time demon in my machine... it eats 2 hours have checked everything!

I have my checked my environment.rb config.time_zone = 'Prague' Nothing in development.rb regarding time This seems to work, in theory... Time.zone.now # Thu, 10 Sep 2009 17:51:35 CEST +02:00 also correct... Time.now # Thu Sep 10 17:52:10 +0200 2009 mysql... SELECT NOW() # 2009-09-10 17:...

51
голосов
4ответов
42740 просмотров

pytz localize vs datetime replace

I'm having some weird issues with pytz's .localize() function. Sometimes it wouldn't make adjustments to the localized datetime: .localize behaviour: >>> tz <DstTzInfo 'Africa/Abidjan' LMT-1 day, 23:44:00 STD> >>> d datetime.datetime(2009, 9, 2, 14, 45, 42, 91421) >...

1
голосов
2ответов
669 просмотров

python DST and GMT management into a scheduler

I'm planning to write a sheduler app in python and I wouldn't be in trouble with DST and GMT handling. As example see also PHP related question 563053. Does anyone worked already on something similar? Does anyone already experienced with PyTZ - Python Time Zone Library?

35
голосов
4ответов
32958 просмотров

pytz utc conversion

What is the right way to convert a naive time and a tzinfo into an UTC time? Say I have: d = datetime(2009, 8, 31, 22, 30, 30) tz = timezone('US/Pacific') First way, pytz inspired: d_tz = tz.normalize(tz.localize(d)) utc = pytz.timezone('UTC') d_utc = d_tz.astimezone(utc) Second way, from U...

2
голосов
2ответов
2119 просмотров

ruby on rails converting to users time zone

I have all the time zone information that is needed and it saves all of the information correctly according to this railscast. Everything works great for all the normal purposes like displaying time's in a table, however I am wondering how I can convert the following to the current_users saved ti...

17
голосов
4ответов
7524 просмотров

What is the need for the javascript function getUTCFullYear()?

Is there any real case where getUTCFullYear() differs from getFullYear() in javascript? The same goes for: getUTCMonth() vs getMonth() getUTCDate() vs getDate() Am I missing something here? EDIT: See getUTCFullYear() documentation. Is there any real case where getUTCFullYear() differs fro...

0
голосов
3ответов
1530 просмотров

Date and time handling in applications serving clients in multiple time-zones?

The internationalization problems associated with string handling can pretty much be solved by following the advice: use Unicode and store everything as UTF-8 in your database, then you'll be able to serve clients using all the world's languages. But what about the internationalization problems ...

19
голосов
2ответов
20711 просмотров

How can I determine a timezone by the UTC offset?

I have a scenario where I have a timezone offset (in minutes) and need to determine the timezone for it. I know that all the data is not available (for example, there may be several timezones with an offset of -240 minutes) but a "best guess" is acceptable. My first pass looked like this: fore...

22
голосов
7ответов
19403 просмотров

Nil NSDate when trying to get date from UTC string in zulu time

Writing an iPhone app in Objective-C, I have a date in string form (in UTC format, with a Z on the end to denote zero UTC offset, or zulu time), which I need to parse into an NSDate object. A bit of code: NSDateFormatter* df = [[NSDateFormatter alloc]init]; [df setDateFormat:@"yyyy-MM-dd'T'HH:mm:...

4
голосов
2ответов
1311 просмотров

Converting old and new local times to UTC under Windows XP/Server 2003

My application converts past and present dates from local time to UTC. I need to ensure I will honor any future DST updates to Windows while still correctly handling past dates. The application is written in C++ and is running on Server 2003. Options I've researched: gmtime() and localtime()...

1
голосов
3ответов
2960 просмотров

Axapta/DynamicsAx: UTC datetime conversion

We are trying to interpret the data stored in Axapata's TIMEZONESRULESDATA table. Particularly, we'd like to figure out how it stores DST begin/end times. So far, my guess is: TZENUM: foreign key referencing TIMEZONESLIST (time zone name and identifier) YEAR: 0 if rule is valid indefinitely or a...

80
голосов
10ответов
217700 просмотров

TSQL: How to convert local time to UTC? (SQL Server 2008)

We are dealing with an application that needs to handle global time data from different time zones and daylight savings time settings. The idea is to store everything in UTC format internally and only convert back and forth for the localized user interfaces. Does the SQL Server offer any mechanis...

63
голосов
4ответов
49316 просмотров

How does DateTime.ToUniversalTime() work?

How does the conversion to UTC from the standard DateTime format work? More specifically, if I create a DateTime object in one time zone and then switch to another time zone and run ToUniversalTime() on it, how does it know the conversion was done correctly and that the time is still accurately ...

45
голосов
5ответов
141761 просмотров

How to get UTC value for SYSDATE on Oracle

Probably a classic... Would you know a easy trick to retrieve an UTC value of SYSDATE on Oracle (best would be getting something working on the 8th version as well). For now I've custom function :( Cheers, Stefan

1
голосов
3ответов
8080 просмотров

How do you create a UTC time in C for a specific day, month and year?

How do I create a UTC time in C for the following date: 1st July 2038 using standard ANSI C function calls (given that the tm_year element of the tm structure cannot be greater than 137) ?

0
голосов
3ответов
2178 просмотров

expiry date using utc timestamp, mysql and php?

How do you add time or days to a current utc_timestamp? I am using; new CDbExpression('UTC_TIMESTAMP()') for both 'created' and 'updated' fields in my mysql table but would like to add an 'expiry' field which would allow 4 days from creation date. I presume this is possible but am unsure how.

19
голосов
7ответов
3130 просмотров

Is there ever a good reason to store time not in UTC?

I am wondering if there are any good reasons to ever store time information in anything other that UTC (GMT)? I believe that this is a solid rule for all software engineering. The conversion to local time is merely a translation that happens at the UI layer for display purposes. I have also seen ...

5
голосов
2ответов
827 просмотров

как отобразить для пользователя местное время, используя время UTC (asp.net & ajax)

У меня проблема, когда мои данные сохраняются как дата и время в формате utc и я хочу, чтобы мои пользователи видели правильное время (свое) по местному времени. Я могу сделать это с помощью javascript, который отправляет местное время с клиентского компьютера на сервер, но это заставит мен...

6
голосов
4ответов
3387 просмотров

Время Python Unix не работает в Javascript

В Python, используя calendar.timegm (), я получаю 10-значный результат для временной метки unix. Когда я помещаю это в функцию Javscript setTime (), появляется дата 1970 года. Очевидно, ему нужна временная метка unix длиной 13 цифр. Как такое могло случиться? Считают ли они оба с одного дня? ...

0
голосов
1ответов
1119 просмотров

Преобразует ли SQL Server 2005 автоматически поля времени в формат UTC? Есть ли в ADO.Net?

Я использую Visual Studio 2008. Я использую .xsd / tableadapters для доступа к базе данных SQL Server 2005. В одной из моих таблиц есть поле DateTime. Когда запись вставляется в таблицу, время автоматически конвертируется во время UTC, и это нормально. Я просто хочу знать, где это происходит. Вы...

0
голосов
1ответов
148 просмотров

Странное поведение created_at

Я установил config.time_zone = 'UTC' в environment.rb, но все же у меня наблюдается странное поведение со встроенными полями даты и времени Rails: >> Time.now => Sun Jun 21 17:05:59 -0700 2009 >> Feedback.create(:body => "testing") => #<Feedback id: 23, body: "testing"...

0
голосов
2ответов
312 просмотров

MySQL и международные даты

Допустим, у меня есть несколько серверов в разных местах, и я хочу использовать тип MySQL datetime для даты поля, и я всегда хочу, чтобы дата поля имела метку времени в формате UTC, поэтому я бы выполнил UTC_TIMESTAMP(), когда добавляю его в базу данных. Теперь предположим, что я хочу, чтобы MyS...