utc

Illegal pattern character 'T' when parsing a date string to java.util.Date

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a date string and I want to parse it to normal date use the java Date API,the following is my code: public static void main(String[] args) { String date="2010-10-02T12:23:23Z"; String pattern="yyyy-MM-ddThh:mm:ssZ"; SimpleDateFormat sdf=new SimpleDateFormat(pattern); try { Date d=sdf.parse(date); System.out.println(d.getYear()); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } However I got an exception: java.lang.IllegalArgumentException: Illegal pattern character 'T' So I wonder if I have to

Error getting endorser client channel: endorser client failed to connect to peer0.org1.example.com:7051

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am new to Hyperleger Fabric. I'm reading a tutorial on Building Your First Network and got stuck in the fabric-samples/first-network sample. I first run: ./byfn.sh generate Then I run: ./byfn.sh up The result of this is: Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds Continue? [Y/n] y proceeding ... 2018-08-03 02:56:16.574 UTC [main] main -> INFO 001 Exiting..... LOCAL_VERSION=1.1.1-snapshot-DOCKER_IMAGE_VERSION=1.1.0 =================== WARNING =================== Local fabric binaries and

Creating a DateTime object with a specific UTC DateTime in PowerShell

China☆狼群 提交于 2019-12-03 01:19:52
I'm trying to create a DateTime object with a specific UTC timestamp in PowerShell. What's the simplest way to do this? I tried: Get-Date -Format (Get-Culture).DateTimeFormat.UniversalSortableDateTimePattern -Date "1970-01-01 00:00:00Z" but I get this output: 1969-12-31 19:00:00Z It's a few hours off. Where's my lapse in understanding? The DateTime object itself is being created with the proper UTC time. But when PowerShell prints it out it converts it to my local culture and time zone, thus the difference. Proof: $UtcTime = Get-Date -Date "1970-01-01 00:00:00Z" $UtcTime.ToUniversalTime()

MomentJS getting JavaScript Date in UTC

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am not able to get the JavaScript Date string for MongoDB record via the following. It keeps using my local time. var utc = moment.utc().valueOf(); console.log(moment.utc(utc).toDate()); Output: Tue Nov 11 2014 14:42:51 GMT-0500 (EST) I need it to be in UTC, so I can stick this timestamp in Mongo so type would be Date . How can I do that? 回答1: A timestamp is a point in time. Typically this can be represented by a number of milliseconds past an epoc (the Unix Epoc of Jan 1 1970 12AM UTC). The format of that point in time depends on the time

How can I set a Calendar with UTC time?

血红的双手。 提交于 2019-12-03 01:10:57
The posters here say that Date is always in UTC time. However, if I create a Date(), create a Calendar, and set the calendar time with the date, the time remains my local time (and I am not on UTC time. I've tested this by printing out the calendar's date in a loop, subtracting an hour per loop. It's 11pm on the 19th of May here, and it takes 24 loops before the date changes to the 18th of May. It's currently 1pm UTC, so if the calendar were set properly it would only take 14 loops. Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); SimpleDateFormat

Amazon S3 boto - how to create a folder?

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I create a folder under a bucket using boto library for Amazon s3? I followed the manual, and created the keys with permission, metadata etc, but no where in the boto's documentation it describes how to create folders under a bucket, or create a folder under folders in bucket. 回答1: There is no concept of folders or directories in S3. You can create file names like "abc/xys/uvw/123.jpg" , which many S3 access tools like S3Fox show like a directory structure, but it's actually just a single file in a bucket. 回答2: Assume you wanna

Should MySQL have its timezone set to UTC?

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Follow up question of https://serverfault.com/questions/191331/should-servers-have-their-timezone-set-to-gmt-utc Should the MySQL timezone be set to UTC or should it be set to be the same timezone as the server or PHP is set? (If it is not UTC) What are the pros and cons? 回答1: It seems that it does not matter what timezone is on the server as long as you have the time set right for the current timezone, know the timezone of the datetime columns that you store, and are aware of the issues with daylight savings time. On the other hand if you

The UTC time represented when the offset is applied must be between year 0 and 10,000. Parameter name: offset

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following code in an ASP.NET MVC3 Controller: public PartialViewResult GetCalendar(int? month, int? year) { var test = new DateTime((year.HasValue ? year.Value : 1), (month.HasValue ? month.Value : 1), 1); return PartialView("Calendar", new DateTimeOffset(test)); } My view model is DateTimeOffset? What is the reason for the exception thrown? 回答1: The DateTimeOffset constructor first converts any DateTime that is not of Kind 'UTC' to the equivalent UTC time. It will then check whether the UTC-equivalent DateTime falls outside of

Local solar time function from UTC and longitude

匿名 (未验证) 提交于 2019-12-03 01:02:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm wondering if there is a python function/module that calculates the local time after midnight (or local solar time) given the UTC time and longitude? It doesn't need to take into account daylight saving time. Thanks in advance. 回答1: Or if you want to go even shorter, you could use NOAA's low-accuracy equations : #!/usr/local/bin/python import sys from datetime import datetime, time, timedelta from math import pi, cos, sin def solar_time(dt, longit): return ha def main(): if len(sys.argv) != 4: print 'Usage: hour_angle.py [YYYY/MM/DD] [HH

Python datetime and utc offset conversion ignoring timezone/daylight savings

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have two operations I want to perform, one the inverse of the other. I have a UNIX timestamp at UTC, say for instance, 1425508527. From this I want to get the year, month, day etc. given a UTC offset. EG. what is the year/month/day/time in (UTC -6 hours)? The answer is March 4, 2015 at 16:35:27. Without providing an offset (or offset zero) the answer should be March 4, 2015 at 22:35:27. Now I have the date at some location, along with the UTC offset. For instance March 4, 2015 at 16:35:27 and the offset (UTC -6 hours). The UNIX UTC