utc

SQL Server - Convert date field to UTC

I have recently updated my system to record date/times as UTC as previously they were storing as local time. I now need to convert all the local stored date/times to UTC. I was wondering if there is any built in function, similar to .NET's ConvertTime method? I am trying to avoid having to write a utility app to do this for me. Any su...

Python: Figure out local timezone

I want to compare UTC timestamps from a log file with local timestamps. When creating the local datetime object, I use something like: >>> local_time=datetime.datetime(2010, 4, 27, 12, 0, 0, 0, tzinfo=pytz.timezone('Israel')) I want to find an automatic tool that would replace thetzinfo=pytz.timezone(...

javascript conversion string to UTC date

I'm converting string to timestamp by using var timestamp = new Date(month+"/"+day+"/"+year).getTime()/ 1000; My question is how to set it as UTC timezone before converting to timestamp ? ...

how to show a UTC time as local time in a webpage

I have a database that holds a time as UTC. This time can be shown in a webpage, so I’ve been asked to show it as local time in the page as it can be viewed from any country. A colleague mentioned something about getting the country settings from the current thread but I couldn’t find any details on this. Is what I want to do possible? ...

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

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 operatio...

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

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.UtcNo...

Convert historic dates from utc to local time

I have an sql table with data like this: | theDate (datetime) | theValue (int) | ---------------------------------------- | 2010-05-17 02:21:10 | 5 | | 2009-03-12 04:11:35 | 23 | | 2010-02-19 18:16:53 | 52 | | 2008-07-07 22:54:11 | 30 | The dates are stored in UTC format in a datetime ...

recommended format to save time with MJD + BCD format in database

Hi, There is a time represented in MJD and BCD format with 5 bytes .I am wondering what is the recommended format to save this date-time in the sqlite database so that user can search against it ? My first attempt is to save it just as it is, that is a 5 bytes string. The user will use the same format to search and the result will be ...

Find UTC Offset given a city

In C++ on Windows, given a city, lets say london or newyork or sydney or singapore etc.. how do I find the UTC offset for each of them, ie the function should be able to accept a city name and return the UTC offset in the current scenario ie taking into account daylight savings. Any ideas how this can be done using win32 APIs ...

Getting computer's utc offset in Python

Hopefully a simple question, but I've been searching and searching with no luck: In Python, is there a way to figure out what utc time offset the computer is set to? ...

Can I convert between timezones in SQL Server?

Right now I'm storing a number of records in SQL Server with a DATETIME column that stores the current timestamp using GETUTCDATE(). This ensures that we're always storing the exact date without having to worry about questions like "well is this 2:00 my time or 2:00 your time?" Using UTC ensures that we know exactly when it happened rega...

how do I insert a string datetime into mysql using c++

I have a datetime field in the following format: string date = "Jun 23 19:47:15 +0000 2010"; how do I insert it ito datetime field in mysql table? I am assuming I have to convert the date into unix timestamp before I insert it into the table. ...

Are UtcNow and Now the same datetime? Do they know they're different?

If I run a snippet like: bool areTheyTheSame = DateTime.UtcNow == DateTime.Now what will I get? Does the DateTime returned know its timezone such that I can compare? My specific problem is that I'm trying to build a cache-like API. If it takes a DateTime AbsoluteExpiration, do I have to enforce that users of my API know whether t...

How to Convert to UTC

I'm getting dates & times from various sources (e.g. file's date/time from FTP server, email's date/tiem received, etc.) and need to store them all as UTC (so they all have a common reference). How do I do this? What pieces of information do I need in order to properly do the conversion. This is for a PHP web application. So, I can get ...

HOW TO GET: Time Zone Setting of FTP Server?

I'm using PHP's ftp_rawlist function to get a listing of files and their associated last-modified date/time. For my purposes, I need to know the time zone (or offset) of the the last-modified date/time. The dates/times alone are useless to me as I need to convert them to UTC. Is there anyway to figure out what the FTP server's time zone...

Web Service to Get Current UTC Time?

I'm building a PHP web application and need to know what the current date/time is. I cannot depend on the server's setting. Any web service I can use? I know there will be some delay accessing the time via web service, but I am fine with something that is not accurate to the last millisecond. ...

How can I convert a Python datetime object to UTC?

I have a python datetime object which I would like to convert to UTC. I am planning to output it in RFC 2822 format to put in an HTTP header, but I am not sure if that matters for this question. I found some information on this site about converting time objects, and it looks simpler that way, but this time I really want to use datetime ...

UTC - Working one day behind

I have an application which records statistics. When a user submits their statistics the information is stored and the date/time is recorded as UTC e.g. In the UK if I recorded figures at 03/08/2010 10:30 my recorded date/time would be 03/08/2010 09:30 as we are currently observing DST. If I was in say Australia, and I recorded my stat...

MySQL default time format UTC or GMT ?

Hi I'm so confused with this UTC and GMT I'm inserting in MySQL table as ex column "event_date" like "2010-07-01 23:50:00" (datetime) my client asking an option in front end as GMT +1 GMT +2 GMT -1 GMT -2 ...etc if I select any option GMT +2 the event_date will filter/list according to the GMT +2. I have no idea how to proceed and aft...

Getting timezone for JavaScript and PHP all mixed up.

I'm trying to synchronize the timezone between a PHP script and some JavaScript code. I want a PHP function that returns a timestamp in UTC. Does gmmktime() do that? On the JavaScript side, I have: var real_date = new Date(); real_date -= real_date.getTimezoneOffset() * 60000; real_date /= 1000; Does this convert the timestamp...