timezone

How to convert datetime on a per user basis

谁都会走 提交于 2019-12-12 02:25:12
问题 I have left my application.rb as it was and by default it is storing datetime in UTC. Now at the UI level (for displaying only) I want to convert the datetime to the user specific timezone. How can I convert the UTC datetime I get from postgresql and then convert it to the timezone that I will store for each user. I want to make this conversion using the Offset so like: -5:00 or +4:00 Is it ok to do this, because I was just checking some locations and it seems their offset changes during the

Get Latitude and Longitude from Time Zone in Java

≡放荡痞女 提交于 2019-12-12 02:24:55
问题 I'm trying to write a world clock app that returns the sunrise and sunset information for a given time zone. The thinking is that the user will either specify the GMT offset or give the time zone explicitly. Then the application will look up the latitude and longitude using the java.util.TimeZone found (or possibly given the GMT offset). I realize the time zones are usually not a very accurate way to get geolocation information since they are mostly based on political borders, but it seems

Strongloop How to config mysql timezone?

橙三吉。 提交于 2019-12-12 02:23:18
问题 I'm a greenhand for strongloop. My datasources.json config is as follows: "platformDB": { "host": "localhost", "port": 3306, "database": "way", "username": "root", "password": "root", "name": "platformDB", "connector": "mysql" }, and UserAccount is my one model as follows: "name": "UserAccount", "plural": "user", "base": "PersistedModel", "idInjection": true, "properties": { "id": { "type": "number", "required": false }, "accountName": { "type": "string", "required": false }, "roleName": {

Oracle sql query needs to change based on timezone

爱⌒轻易说出口 提交于 2019-12-12 02:17:51
问题 I have a sql query to obtainrecords for a date range. My query works find byut when I analyzed data, I found that the records are retirved base don GMT timezone value, thus making the restults incorrect. I get my time from a unix epoch value in database. SELECT tableA.columnA,tableB.columnB FROM tableA INNER JOIN tableB ON tableA.aId = tableB.aId WHERE (to_date('1970-01-01 00:00:00 +10:00','yyyy-MM-dd hh24:mi:ss') + (tableB.epochValue/60/60/24/1000)) > to_date('--FROM_DATE--', 'yyyy-MM-dd

UTC to user's local time

点点圈 提交于 2019-12-12 01:37:32
问题 I am creating a web application that will display the dates of various events that happened within the application (like a document being produced, for instance). Of course, the date displayed needs to be considerate of where the user is located (not just blindly output the stored date, since that would be the server local time). I've made a sample application that lists all the time zones, lets you choose one and then outputs some stored UTC dates in your selected time zone, adding an hour

How accurate is automatic detection of device timezone?

醉酒当歌 提交于 2019-12-12 01:32:47
问题 Was looking at this tutorial here http://pellepim.bitbucket.org/jstz/ on automatic timezone detection using javaScript which detects the device's time zone setting. I was wondering if anyone had any idea (ballpark is fine) of how accurate this method is of detecting timezones? Thanks for your time! 回答1: From the "limitations" section of the project page: This script does not do geo-location, nor does it care very much about historical time zones. So if you are unhappy with the time zone

The standard way for switching from/to user_timezone and gmt

南楼画角 提交于 2019-12-11 23:03:33
问题 I use php's date_default_timezone_set() and set it according to user's timezone field in the the user table. So with ease I can show date/time to users and get date/time from them. But for storing date related values in database, I have to use the standard GMT timezone. The question: What is the best or maybe the standard way for switching to/from user_timezone and GMT? Do you suggest me to follow these steps when I want to insert or update a field in database? Change the timezone using date

Cakephp Fatal error: Call to a member function format() on a non-object

橙三吉。 提交于 2019-12-11 22:57:41
问题 i am working on a Cakephp 2.3 .. here is my code class MessagesController extends AppController{ public $helpers = array('Time'); public function messages(){ $datetime= $this->Message->getDatetime($userid); //$datetime = 2013-06-14 10:28:00 $time = $this->Userinfo->getTimeZone($userid); //$time = 5.00 $finaltime = $this->Time->format('Y-m-d H:i:s', $dateTime, NULL, $time); exit(); } it is giving me Fatal error: Call to a member function format() on a non-object anybody know what i am doing

Parsing dates using localtimezone to date object in javascript

断了今生、忘了曾经 提交于 2019-12-11 20:36:32
问题 I want to parse a date into a javascript date object. I am using the following new Date(Date.parse('2012-08-01')) The problem is my input date can be in multiple formats and parsing it should always give me the date object with the date as 2012-08-01 00:00:00 in local timezone. What are possible options in javascript without using any third party libraries ? I have a possible solution. But my concern is should i be worried that this will not work in certain android/iphone/kindle/surface

How to get the current local time or system time in spark-scala dataframe?

僤鯓⒐⒋嵵緔 提交于 2019-12-11 19:35:57
问题 I am trying to get the local time in spark-scala but it is returning UTC. I am using java.time.LocalDateTime to get the current timestamp. But its returning the UTC standard. java.sql.Timestamp.valueOf(DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss.SSSSSS").format(LocalDateTime.now)) The LocalDateTime is returning local time in spark shell, but in my code it is giving UTC standard. val time: LocalDateTime = LocalDateTime.now How to get the current time? The current output is UTC. I need the