utc

Javascript: Convert a UTC Date() object to the local timezone

我的未来我决定 提交于 2019-12-01 16:46:29
问题 I have a Date() object that contains a UTC date, which I need converted to the users local timezone. Does anybody know how I could do this? :-) 回答1: I usually create a new Date object and use the Date.setUTC* functions to copy the date information. 回答2: I'm pretty sure it is done for you automatically. >>> d = new Date('Fri, 10 Jun 2011 19:49:23 UTC'); Sat Jun 11 2011 07:49:23 GMT+1200 (New Zealand Standard Time) >>> d.getHours(); 7 回答3: This is an old thread, but just in case anyone else

.NET converting datetime to UTC given the timezone

人走茶凉 提交于 2019-12-01 15:18:58
Using C#, I need to convert incoming datetime values into UTC. I know there is functionality in .NET for these conversions but all I have to identify the timezone is the standard timezone list http://www.timegenie.com/timezones What's the best way to do this in .NET? Will I need to create a mapping table to convert the timezones to the IDs in TimeZoneInfo.GetSystemTimeZones() (e.g. "Pacific Standard Time (Mexico)") so that I can then use TimeZoneInfo.FindSystemTimeZoneById()? Thanks for any help I've done it before by storing the timezone id in the database using a mapping table. i.e. A table

.NET converting datetime to UTC given the timezone

左心房为你撑大大i 提交于 2019-12-01 15:02:32
问题 Using C#, I need to convert incoming datetime values into UTC. I know there is functionality in .NET for these conversions but all I have to identify the timezone is the standard timezone list http://www.timegenie.com/timezones What's the best way to do this in .NET? Will I need to create a mapping table to convert the timezones to the IDs in TimeZoneInfo.GetSystemTimeZones() (e.g. "Pacific Standard Time (Mexico)") so that I can then use TimeZoneInfo.FindSystemTimeZoneById()? Thanks for any

java display Windows UTC time

坚强是说给别人听的谎言 提交于 2019-12-01 14:10:59
Windows stores FileTime internally as the number of 100-nanoseconds since 1.1.1601 UTC as a 64bit field, is it possible to get java to print out the current number? Just looking for an example as I can't find a way to do it. I would like to print the number out? Any help woudl be greatful! Thanks. Approximately long diff1601to1970 = 315532800 * 1000000000; // <-- diff in nanoseconds(1/1/1601 to 1/1/1970) long currentFrom1970 = System.currentTimeMillis() * 1000000; long currentFrom1601 = diff1601to1970 + currentFrom1970; Java doesn't provide direct access to a raw file time, so if you ask for

How to store date-time in UTC into a database using EclipseLink and Joda-Time?

南楼画角 提交于 2019-12-01 10:54:46
I have been fumbling with the following EclipseLink Joda-Time converter for a long time to store date-time in UTC into MySQL database with no success at all. import java.util.Date; import org.eclipse.persistence.mappings.DatabaseMapping; import org.eclipse.persistence.mappings.converters.Converter; import org.eclipse.persistence.sessions.Session; import org.joda.time.DateTime; public final class JodaDateTimeConverter implements Converter { private static final long serialVersionUID = 1L; @Override public Object convertObjectValueToDataValue(Object objectValue, Session session) { //Code to

How to convert Date into UTC in MongoMapper & Ruby/Rails?

為{幸葍}努か 提交于 2019-12-01 08:59:15
I added this line of code self.auth_history.push [start_date, self.coupon_code] And got this error message Date is not currently supported; use a UTC Time instance instead. I also tried start_date.utc , but it didn't work either. Please help. Thanks. I got this answer from Seattle Brigade group - === I didn't see start_date defined in your code as a key in MongoMapper, so I'll assume you're creating your own date object, either directly via Ruby, or wrapped by Rails. As far as I know, and someone please correct me, Mongo stores dates as UTC time in milliseconds since epoch. So when you define

JSON time service “json-time.appspot.com” is broken. Anyone have a replacement?

筅森魡賤 提交于 2019-12-01 08:08:36
http://json-time.appspot.com/time.json?tz=GMT has been broken for a while now... at least a month. This service returns the current time in jsonp, and I have a jquery plugin that uses it to determine the correct time. I'm under the assumption that this service is permanently down since it's been down for a long time and I can't find any posts by the author as to it's status. Does anyone know of a service that I can use that returns the correct time in JSON or XML? Thanks! Looks like you can set up your own: https://github.com/simonw/json-time 来源: https://stackoverflow.com/questions/7520793

GMT UTC 时区等概念

核能气质少年 提交于 2019-12-01 07:31:13
时间戳 定义:格林威治时间1970年01月01日00时00分00秒( 北京时间1970年01月01日08时00分00秒 )起至现在的总秒数,表示为:1970-01-01 00:00:00 UTC。 它称为Unix时间(Unix time)、POSIX时间(POSIX time)。 从定义可以看到, 全球相同时刻,不管你是什么时区, 时间戳是一致的 , 时间戳是不会跟着时区的改变而改变。用时间戳来表示时间全球都是一致的 相同时间戳,在不同时区,时间是不同的:如 1520411719 时间戳,对应北京时间是:2018-03-07 16:35:19 GMT+8,对应此时的美国华盛顿时间是:2018-03-07 03:35:19 GMT-5,这也是我们常说的时间。 格林威治时间(GMT) 是指位于英国伦敦郊区的皇家格林尼治天文台当地的平太阳时,因为本初子午线被定义为通过那里的经线。 协调世界时(UTC) 协调世界时(英语:Coordinated Universal Time简称UTC)是最主要的世界时间标准,其以原子时秒长为基础, 在时刻上尽量接近于格林尼治标准时间 。 协调世界时是世界上调节 时钟 和 时间 的主要时间标准,它与0度经线的平太阳时相差不超过1秒[4],并不遵守夏令时。 协调世界时是最接近格林威治标准时间(GMT)的几个替代时间系统之一。 对于大多数用途来说

How to convert Date into UTC in MongoMapper & Ruby/Rails?

為{幸葍}努か 提交于 2019-12-01 07:17:15
问题 I added this line of code self.auth_history.push [start_date, self.coupon_code] And got this error message Date is not currently supported; use a UTC Time instance instead. I also tried start_date.utc , but it didn't work either. Please help. Thanks. 回答1: I got this answer from Seattle Brigade group - === I didn't see start_date defined in your code as a key in MongoMapper, so I'll assume you're creating your own date object, either directly via Ruby, or wrapped by Rails. As far as I know,

JSON time service “json-time.appspot.com” is broken. Anyone have a replacement?

£可爱£侵袭症+ 提交于 2019-12-01 06:51:52
问题 http://json-time.appspot.com/time.json?tz=GMT has been broken for a while now... at least a month. This service returns the current time in jsonp, and I have a jquery plugin that uses it to determine the correct time. I'm under the assumption that this service is permanently down since it's been down for a long time and I can't find any posts by the author as to it's status. Does anyone know of a service that I can use that returns the correct time in JSON or XML? Thanks! 回答1: Looks like you