utc

Javascript momentjs convert UTC from string to Date Object

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Folks, Having a difficult time with moment.js documentation. record.lastModified = moment.utc().format(); returns: 2014-11-11T21:29:05+00:00 Which is Great, its in UTC... When I store that in Mongo, it gets stored as a String , not a Date object type, which is what i want. What I need it to be is: "lastModified" : ISODate("2014-11-11T15:26:42.965-0500") But I need it to be a native javascript object type, and store that in Mongo. Right now if i store the above, it goes in as string, not Date object type. I have tried almost everything with

inconsistency issue with Objectify query result and Datastore viewer result?

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm coding a sample project based on TodoMVC angularjs ( http://todomvc.com/ ) and with a backend api with Google App Engine Cloud Endpoint and I'm having some consistency result when getting the todos liste from App Engine Datastore. Todo object are stored in the App Engine Datastore using objectify. A Todo entity is coded as follow: @Entity public class Todo { @Id private Long id ; private String title ; private boolean completed ; private Date lastEdit ; @Index private Long userId ; public Todo () { } public Todo ( String title

C# convert UTC int to DateTime object

匿名 (未验证) 提交于 2019-12-03 03:02:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I don't know why this is so complicated! I have a plugin that is passing in a long int UTC. I need to convert that number into a DateTime to query my database (SQL Server). I don't know why, but I can't find a workable answer from a basic google search. (For extra credit, I need to turn my returned DateTime back into a UTC at the end of the day.) This is embarrassing to have to ask such a basic question! :) 回答1: My guess is it's going to be either milliseconds or seconds since a particular epoch - quite possibly the Unix epoch of January 1st

Typescript Date Type?

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do I express dates in TypeScript? Dates aren't a TypeScript type , so do I use any or object ? Seems like there would be a "right" way to do: let myDate: any = new Date(); I couldn't find much on Google, despite it being such a simple question. 回答1: The answer is super simple, the type is Date : const d: Date = new Date(); // but the type can also be inferred from "new Date()" already It is the same as with every other object instance :) 回答2: Any class or interface can be used as a type in TypeScript. const date = new Date(); will

How to set timezone to UTC in Play Framework 2.0 for both production and tests?

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: We'd like our Play Framework 2.0 Scala applications to handle all date and time information in UTC, both in the app servers and in MySQL database servers. The trick is: Without changing deployment environment Without changing CI (testing) environment Without changing local (dev) environment Is there a standard best practice to do this? We want the tests to run in UTC, without having to pass -Duser.timezone=GMT on all commandlines. Ditto for bringing up servers with play start . 回答1: This was easier than we'd expected. First, in

NodeJS responded MySQL timezone is different when I fetch directly from MySQL

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I request MySQL directly, I get back date in UTC (I set UTC in MySQL server), but with NodeJS I get UTC+2 local time zone data, why? How can I set NodeJS to get UTC? 回答1: I have added timezone in index.js when initializing mysql connection var db_config = { host : 'localhost', user : 'xxx', password : '', database : 'xxx', timezone: 'utc' //<-here this line was missing }; 回答2: Although this is an old question, I had a similar problem and adding the config timezone: 'utc' did not solve the problem (it get worse). The solution I finally

Force Java timezone as GMT/UTC

匿名 (未验证) 提交于 2019-12-03 02:51:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to force any time related operations to GMT/UTC, regardless the timezone set on the machine. Any convenient way to so in code? To clarify, I'm using the DB server time for all operations, but it comes out formatted according to local timezone. Thanks! 回答1: The OP answered this question to change the default timezone for a single instance of a running JVM, set the user.timezone system property: java -Duser.timezone=GMT ... If you need to set specific time zones when retrieving Date/Time/Timestamp objects from a database ResultSet , use

LocalDateTime to ZonedDateTime

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have Java 8 Spring web app that will support multiple regions. I need to make calendar events for a customer location. So lets say my web and Postgres server is hosted in MST timezone (but I guess it could be anywhere if we go cloud). But the customer is in EST. So, following some best practices I read, I thought I would store all date times in UTC format. All date time fields in the database are declared as TIMESTAMP. So here is how I take a LocalDateTime and convert to UTC: ZonedDateTime startZonedDT = ZonedDateTime.ofLocal(dto

Difference between UTC and GMT Standard Time in .NET

匿名 (未验证) 提交于 2019-12-03 02:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In .NET, the following statements return different values: Response.Write( TimeZoneInfo.ConvertTime( DateTime.Parse("2010-07-01 5:30:00.000"), TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"), TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time")) ); // displays 7/1/2010 1:30:00 PM ..and this... Response.Write( TimeZoneInfo.ConvertTime( DateTime.Parse("2010-07-01 5:30:00.000"), TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"), TimeZoneInfo.FindSystemTimeZoneById("UTC")) ); // displays 7/1/2010 12:30:00 PM Why is

Error starting up a network. Nodes in different VM - Failed connecting to orderer0.tec.com:7050 , error: context deadline exceeded

匿名 (未验证) 提交于 2019-12-03 02:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm starting up a network, which will have 3 peers and an orderer. I have 4 different Virtual Machines, one for each node. I follow the Getting Started manual for Hyperledger Fabric. I execute all the steps without any problem. However, after executing the following command peer channel join -b channeldemo.block , I start getting some erros. It seems to me that the previous command is generated well, because I get the following logs: 2017-06-27 08:26:23.247 UTC [channelCmd] executeJoin -> INFO 00a Peer joined the channel! 2017-06-27 08:26:23