utc

Java How to convert UTC milliseconds into UTC Date

感情迁移 提交于 2019-12-08 13:23:30
I have an int 1446159600 which is UTC/GMT date Thu, 29 Oct 2015 23:00:00 GMT. I tried to do conversion to the actual UTC date, but couldn't get it to work with Calendar, SimpleDateFormat, and Timezone classes. Can someone help me? // print the time in local time zone Date date = new Date(1446159600); System.out.println(date); // print UTC time TimeZone utcTimeZone = TimeZone.getTimeZone("UTC"); Calendar calendar = Calendar.getInstance(utcTimeZone); SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "EE MMM dd HH:mm:ss zzz yyyy", Locale.US); simpleDateFormat.setTimeZone(utcTimeZone);

How to get current utc time in Lua script? [closed]

为君一笑 提交于 2019-12-08 12:57:53
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . How can I get current utc time using Lua script and convert it to human readable text. 回答1: Try os.date("!%c") . Here ! means UTC and %c means full date in standard format. For other options, see http://www.lua.org/manual/5.2/manual.html#pdf-os.date. 来源: https://stackoverflow.com/questions/18982730/how-to-get

how to handle time zones and dates in multi country/lingual application

梦想与她 提交于 2019-12-08 12:52:37
问题 I am currently working on a c# web application with a backend sql server database. I have some issues around dates that I need to work out. The application is hosted on web and database server in GMT time. The users are spread across 3 different time zones CEST, MSK, ALMT with the potential to have the site rolled out to other countries over time. In code at present I use DateTime.Now and GETDATE() in SQL, and with the location of the servers, this is GMT. My question is what form should the

UTC Time, Timezones, Daylight Savings, and Daylight Savings switchover dates

假如想象 提交于 2019-12-08 10:03:35
问题 I'm building an application which will be able to send emails at any specific local time to any place in the world. For example, my daily schedule (localtime): 8:00 AM - Send email to John in Toronto, Canada 9:15 AM Western Standard Time (Australia) - Send email to Bob in Perth, Australia 10:12 PM - Send email to Anas in Rabat, Morocco I want to be able to execute this code on and Amazon EC2 server in a single location (e.g. São Paulo, Brasil). I also know that Toronto is in Eastern Standard

Find UTC Offset given a city

这一生的挚爱 提交于 2019-12-08 02:25:34
问题 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 回答1: Sounds like you want an API for searching the zoneinfo / tz database..? Don't know if there is a library with precisely the interface you want. But reading it and

Convert UTC time to python datetime

ぐ巨炮叔叔 提交于 2019-12-08 01:50:33
问题 I have numerous UTC time stamps in the following format: 2012-04-30T23:08:56+00:00 I want to convert them to python datetime objects but am having trouble. My code: for time in data: pythondata[i]=datetime.strptime(time,"%y-%m-%dT%H:%M:%S+00:00") I get the following error: ValueError: time data '2012-03-01T00:05:55+00:00' does not match format '%y-%m-%dT%H:%M:%S+00:00' It looks like I have the proper format, so why doesn't this work? 回答1: Change the year marker in your time format string to

How to handle user's timezone and UTC sync between application and database in CakePHP?

天大地大妈咪最大 提交于 2019-12-08 00:48:00
问题 I need to display dates and times in user's timezone. But I also need to save dates and times in UTC, so my database stay consistent. My cakephp application configured like this: In config/app.php file: 'Datasources' => [ 'default' => [ ... 'timezone' => 'UTC', In config/bootstrap.php file: /* * Set server timezone to UTC. You can change it to another timezone of your * choice but using UTC makes time calculations / conversions easier. */ date_default_timezone_set('UTC'); In my application, a

JAVA UTC to EST from a long UTC timestamp

三世轮回 提交于 2019-12-08 00:39:04
问题 I'm trying to convert a long timestamp that is UTC to Eastern Standard Time and am totally lost. Any hints would be great! Thanks, R 回答1: Try this: Date estTime = new Date(utcTime.getTime() + TimeZone.getTimeZone("EST").getRawOffset()); Where utcTime is Date object of UTC time (if you already have the long value - just use it) 回答2: final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("EST")); c.setTimeInMillis(longTime); Where longTime is the number of milliseconds since the epoch in

Converting DateTime + TimeZone to UTC

早过忘川 提交于 2019-12-07 22:50:04
问题 How can I get universal time for a specified TimeZone, given a DateTime object? My application (a Timer) asks the user to specify a time and a timezone and I need to save the UTC based on the specified time+timezone values. For example, user A specifies DateTime: 07/06/2011 7:30 AM TimeZone: Eastern Standard Time (-5:00). User B specifies: DateTime: 07/06/2011 05:00 PM TimeZone: India Standard Time (+5:30). I believe the UTC for both the above DateTime values will be the same and both of the

Need a SQL Server function to convert local datetime to UTC that supports DST

风流意气都作罢 提交于 2019-12-07 22:19:39
问题 We are migrating an application to Azure, but currently all of our dates are stored as Eastern Standard Time. Since SQL Azure is on UTC and many of our dates are generated from a getdate() call, we're going to have issues if we leave everything as it is. It seems that the option that will provide the least long term headache is to just convert all of our stored dates to UTC, and have them converted to local time on the front end. Unfortunately it seems that there isn't a built-in way to