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:
foreach (var info in TimeZoneInfo.GetSystemTim...
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 associated with date/time handling?
Quest...
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 from getFullYear() in javascript?
...
Hi,
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 UTCDateTimeField
def utc_from_localt...
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?
...
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)
>>> tz.localize(d)
datetime.datetime(2009, 9, 2, 14, 45, 42, 91421,
...
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:53:48
correct!
but when I create a new ...
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. I tried this on two different hosting prov...
Hi,
can anyone help, my date object 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 for the d...
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.
...
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::cout << "Current Time is: "<< to_iso_ext...
Hi, 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 aa
var yearday = time[0].split("-...
//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 in that code) turn the date into UTC forma...
eg.
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 built-in function or win32 api function to do this ?
Any help would be appreciated.
...
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 using urllib to fetch it from a website?
...
Hi all,
I got UTC timestamps and want to display them for different timezones.
Maybe an example can clarify what I am trying to do:
Given the timestamp 1259431620000 those times should be displayed:
Atlanta 13:07
San Francisco 10:07
London 17:07
Sydney 04:07
The cities m...
I'm trying to determine whether a string that represents the date and time, given in a JSON Twitter feed is within a range of timestamp columns in MySQL.
Here's the example string:
'Sat, 31 Oct 2009 23:48:37 +0000',
The +0000 according to the API ( created_at ) indicates it is indeed UTC. Now, I'm using strtotime and date just to con...
The examples for Cache.Add uses DateTime.Now.Add to compute the expiration, i.e. it passes:
DateTime.Now.AddSeconds(60)
as the value of the absoluteExpiration parameter.
I'd have thought that computing it relative to DateTime.UtcNow would be more correct [as there is no ambiguity if Daylight Savings Time starts in the intervening ti...
Hi,
I'm just starting to think properly about rolling out a webapp that will need to do things to users at the start of their day, say 6am. Also at the end of their days.
Everywhere I've been reading about people saying a lot just to use .ToUniversalTime to store the time in UTC, but when I tried this (as I suspected) it didn't work, a...
I'm trying to count the number of hits for a particular URL on our web site by parsing our IIS logs using Log Parser 2.2. Everything seems to be working fine, except that its handling of timestamps is greatly confusing me.
The IIS logs have all of the timestamps expressed in UTC time. Therefore, in my application, I convert the server's...