timezone

Python pandas convert unix timestamp with timezone into datetime

假装没事ソ 提交于 2019-12-11 06:58:24
问题 I have a dataframe: df = pd.DataFrame({'unix_utc_ts': [1503007204222, 1503007210206, 1503007215121, 1503007220475], 'tz': ['+0000', '+0100', 'CEST', 'EEST']}) And I want to convert unix timestamps into datetime with timezone, so I want something like this: df['local_ts'] = pd.to_datetime(df['unix_utc_ts'], unit='ms', tz=df['tz']) The above code doesn't work. Without the tz argument I get this: tz unix_utc_ts utc_ts 0 +0000 1503007204222 2017-08-17 22:00:04.222 1 +0100 1503007210206 2017-08-17

C# 2.0 specific timezone

可紊 提交于 2019-12-11 06:56:29
问题 I am working on a legacy application in .NET 2.0 and I want to convert time from local time (which happens to be UTC+1) to the time in Brazil (that is "E. South America Standard Time" as Windows calls it) and back. I put together this code that I came up with to do the conversion: using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using Microsoft.Win32; namespace timezone { class Program { [DllImport("kernel32.dll", CharSet = CharSet.Auto,

Handling timezones in MySQL without zoneinfo

寵の児 提交于 2019-12-11 06:46:51
问题 There seems to be no way to get MySQL to return formatted times from timestamps without zoneinfo being imported. If I use SET time_zone = '-4:00' and I create a timestamp for 6:00PM Nov 1, when daylight saving time passes, and the timezone changes to -5:00, that event will no longer be displayed at the correct time. Is it possible to load timezone data from the application? Or do I need to get all of my timestamps as UNIX timestamps and convert them in the application? If so, that would

display date/time on website base on user computer time in different country

落爺英雄遲暮 提交于 2019-12-11 06:39:20
问题 I am developing a chatting messenger of website application. For my concept, I avoid to use timezone. When a user post a message, I use php to get my current server date/time and save it onto database. To display the time of all messages to the user, I just need find out the different between server time and user's system time. Let's say the different is 3 hours, i just need use mysql to retrieve recorded server time from database then add it with 3, eg : $message-time-display = $server-time

Error when trying to create an object DateTime in PHP

前提是你 提交于 2019-12-11 06:39:07
问题 Today I got a project written in PHP. There's an error when I try to show a date in a table data set. This is the statement that generates the error: $data = new DateTime($registro["previsao de entrega"]; The error message is this: Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() Failed to parse time string (2 dez 2011 16:00) at position 0 (2): Unexpected character' in C:\www\fluxo_producao\Telas\TelaFluxoProducao.php:941 Stack trace: #0 C:\www\fluxo_producao

Display div based on remote timezone and dates

夙愿已清 提交于 2019-12-11 06:37:13
问题 I'm trying to display a chat div that displays between the hours of 8am-6pm Monday to Friday "Online" or show nothing if offline, based on the Eastern Time Zone (NYC), so that customers from Beijing will see Online or Offline based on these hours. Simply need to show() or hide() the div. So far I have the hours, but I'm not sure how to get them to be in relation to the user time-zone. $(document).ready(function () { var start = new Date(); var end = new Date(); var time = new Date().getTime()

In SSMS, display DateTimeOffset value in local timezone

纵饮孤独 提交于 2019-12-11 06:34:22
问题 Isn't there a way to configure Sql Server Management Studio to, in query results, display the value of a DateTimeOffset column in the client's local timezone, instead of UTC? Example: I'm in timezone +02:00. A value is stored as 2016-07-27 22:00:00.0000000 +00:00 . Currently, this value is displayed as such in query results. I want it to be displayed (formatted) as 2016-07-28 00:00:00.0000000 +02:00 when executing this query on SSMS on my machine. Currently I'm manually using something like

Working with different timezones in Javascript

為{幸葍}努か 提交于 2019-12-11 06:34:03
问题 I am working on a cloud based application which deals extensively with date and time values, for users across the world. Consider a scenario, in JavaScript, where my machine is in India (GMT+05:30), and I have to display a clock running in California's timezone (GMT-08:00). In this case I have to get a new date object, let india_date = new Date() add it's time zone offset value, let uts_ms = india_date.getTime() + india_date.getTimezoneOffset() add california's timezone offset value, let

Get specific UTC date and Time in Lua

依然范特西╮ 提交于 2019-12-11 06:33:18
问题 As an illustration, I want to grab the (UTC) +0000 UTC date and time in LUA. I know there are some answers about this but none of them isn't my answer. The general approach to answering this issue is Find Local Time, then plus or minus the UTC number but I don't know my OS Time Zone because my program cab be run in different locations and I cannot get the timezone from my development environment. Shortly, How can I get the UTC 0 date and time using LUA functions? 回答1: If you need to generate

handling rails + postgres and timezones

限于喜欢 提交于 2019-12-11 05:59:25
问题 I have an application which uses many different timezones... it sets them in a controller and they change depending on the user. All the times are stored in UTC without a timestamp etc. My understanding is this is the normal way for Rails to handle timezones. This works fine 99% of the time until i need to do something directly with Postgres then the Timezone becomes a problem. For example this query is completely wrong except for GMT, for example in Central Time Zone, depending on the hour