I have GWT application which uses Highstock JS library.
I'd like to implement following use case:
User select start and end dates and time from DateField and TimeField controls (GXT). These controls operate with java.util.Date values. I initialize end date by new Date() and start date by current date minus last hour. Controls display dates in user browser's timezone (e.g. GMT+4).
There is a control to select timezone to build chart: local or user defined.
I need to build Highstock chart in selected timezone. Data is stored in database in UTC.
Which settings, time adjustments I need to implement in order to display correct chart?
In general it is correct to use UTC for all timestamps and perform local changes according to user timezone or similar locally in your browser. If you set global.useUTC while creating your Highstock chart, all dates will be handled in UTC timezone.
Related
I have a problem where i want to set a base date to a date time variable in the database. I would then use the base date for my aggregations. And the days subsequent to this base date would be categorised as Day1, Day2 and so on.
So for example, if I want to see cohorts of orders created by the base date - I would want the calculated after this date. I don't want to do this using a date filter.
Image below:
It seems like you could use the DATE function to convert your field, like this:
DATE([Acquisition Date])
If you don't already have the year value stored, but have a method in mind to add it, you could use MONTH([Acquisition Date]) to obtain the month and date and DAY([Acquisition Date]) to obtain the date. You could then use MAKEDATE function to build the date or MAKEDATETIME function to build the datetime value.
Once it's stored as a date value, you could use DATEADD to add and subtract days to it as needed.
There are multiple formulas available for converting Tableau dates, described here: https://help.tableau.com/current/pro/desktop/en-us/functions_functions_date.htm
Is this what you're looking for?
I send a local date to my iCloud container, but when I query it, it returns a UTC date, does anyone know how to change this?
The date also seems to be inconsistent on the dashboard. As you can see, in the data list, the time is local. When I click on it and scroll to the time property, it's UTC.
From Date documentation:
A specific point in time, independent of any calendar or time zone.
So when you are querying the Date from iCloud I am pretty sure you are getting a correct one since it is free of any time zone, so it's dependant on the formatter's locale/time zone when it comes to displaying it.
The date you seen on the record list is date formatter for the locale and timezone of your system. The date you see when you open record details is the same point in time but displayed as UTC date.
e.g. I live in Poland and my timezone is UTC+2 so for me the same Date (point in time) is displayed in the dashboard like this:
I have a google spreadsheet with a cell with my current time.
For example: Meeting at: 17:15
Is there a way, when a person from another computer and timezone opens the spreadsheet, that he can see the time in his current time zone.
Example: Meeting at: 2:15 pm.
Something like cell: =convertTime(17:15,"UTC +1) that automatically shows the 17:15 UTC+1 in your time zone?
Thanks
It's not possible to show different cell values to different users.
Google Sheets has a timezone setting for each spreadsheet but it hasn't a built-in fuction able to get the timezone of the current user. By the other hand custom function are executed anonymously so they will not be able to automatically get the current user timezone.
One option is to use Google Apps Script to create an user interface like a dialog or sidebar that use client-side code to show date / time value in the active user timezone.
Resources
https://developers.google.com/apps-script/guides/sheets
I have table which have a datetime field named date. When doing a POST in order to insert a new row, the date sent from the client (browser) looks like 2015-11-20T14:30:00+10:00 which is actually a correct date and timezone.
However, inside Postgres this date has been inserted as 2015-11-20 04:30:00.000000, which as you can see, is not at all the same as above. I know the problem is related to the timezone. But I cannot seems to figure out a fix.
For information, I have configured my app timezone :
class Application < Rails::Application
config.time_zone = 'Brisbane'
end
Ideas?
2015-11-20T14:30:00+10:00 means that the local time of 14:30 is 10 hours ahead of UTC. Your database field reflects the correct UTC value of 04:30. This is often the desired behavior, especially if the value represent a timestamp - the date and time something occured (past tense).
In PostgreSQL, there are two different types of timestamp fields (reference)
The TIMESTAMP WITH TIME ZONE field accepts an input that contains a time zone offset. It then converts the value to UTC for storage. On retrieval, it uses the session's timezone setting.
The TIMESTAMP, or TIMESTAMP WITHOUT TIME ZONE simply stores the date and time given, ignoring any offset, and not converting to UTC.
Most of the time, you should indeed use TIMESTAMP WITH TIME ZONE. You should only use TIMESTAMP WITHOUT TIME ZONE if you need to retain the local date and time value, such as in scheduling of future events and calculation of business hours. And for those scenarios, it often makes more sense to split date and time into separate DATE and TIME fields.
One last thing - if you can avoid it, avoid using Rails time zones and use standard tzdb zones. "Australia/Brisbane" is the full tzdb identifier equivalent to the Rails "Brisbane" time zone. Refer to the section on Rails time zones at the bottom of the timezone tag wiki.
I found this gem to be incredibly useful and easy for correctly setting the time https://github.com/kbaum/browser-timezone-rails
I'm keeping the current date in a model using a datetime field in which I am indicating default to take the current date as a value.
_defaults = {
'f_inicio' : lambda *a: datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
}
Assuming that the current date is '07/10/2013 17:24:05 ', in the view is the date '07/10/2013 12:24:05' and rectified in the database and the date is '07/10/2013 17:24:05'; gather that this subtracting five hours. The user can set the time zone 'America/Bogota', Colombia is in the region (GTM - 5:00). But do not understand how to properly show when the user since I get a totally different value that should show. Apparently this taking as 'GTM 0' the GTM Colombia. Taking the approximate date create_date field that should have given me as default is '2013-10-07 22:24:05.384'.
Anyone have any idea what may be happening, really appreciate any help on this issue that is driving me crazy.
This drived me too crazy in the past. This is a real simple issue.
The date stored in the database is UTC (GMT-0) timezone. Assume that the person is set with timezone GMT - 5:00, then while storing the value to the database, the date will be added with 5 hrs (exactly 5, not little more or little less) and thus we get the UTC time to store into the database. Now when displaying the same it will check for the users timezone and it finds that its GMT - 5:00 so the database time will be subtracted with 5 (again exactly 5, not little more or little less) and displayed the user.
This will be great for system which is used in different timezones. So the understanding is the input is taken in the user's timezone stored in UTC(GMT-0) and displayed to user's timezone (even if the user viewing is in the different timezone the time will be accurate to their timezone)
Note: if the user is not set with the timezone the browsers timezone is considered and will be used with the warning icon on the top corner
That's it. Hope this gives u better clarity!!