timezone

Convert from UTC to local timezone give wrong result

别等时光非礼了梦想. 提交于 2020-05-09 11:55:10
问题 Background I need to convert time string with format: "HH:mm" from UTC to local timezone. For example if UTC time is 09:00, local time (Stockholm/Europe) should be two hours ahead. Problem When I convert 09:00 (UTC) to Stockholm/Europe time I get 10:00. It should be 11:00. func UTCToLocal(date:String) -> String { let dateFormatter = DateFormatter() dateFormatter.dateFormat = "HH:mm" dateFormatter.timeZone = TimeZone(abbreviation: "UTC") let dt = dateFormatter.date(from: date) dateFormatter

JavaScript: How to convert UTC date / time to Mountain Time?

核能气质少年 提交于 2020-05-09 06:37:09
问题 I have been trying to write a script that will take the current time in Denver and output it into a URL. I have been able to get this far: http://jsfiddle.net/Chibears85/h41wu8vz/4/ JS $(function() { var today = new Date(); var ss = today.getUTCSeconds(); var nn = today.getUTCMinutes() - 3; //3 minute delay var hh = today.getUTCHours() - 6; //Offset UTC by 6 hours (Mountain Time) var dd = today.getUTCDate(); var mm = today.getUTCMonth() + 1; //January is 0! var yyyy = today.getUTCFullYear();

Django TruncDate gives null

二次信任 提交于 2020-04-30 08:28:25
问题 I'm using Django 2.2 I'm filtering records using Django query like from datetime import datetime from django.db.models.functions import TruncDate start_date = datetime.strptime('2020-02-01', '%Y-%m-%d').date() end_date = datetime.strptime('2020-03-31', '%Y-%m-%d').date() lead_list = LeadList.objects.all() # Filter query query = LeadListEntry.objects.filter( lead_list__in=lead_list ) # Filter by start date query = query.filter( created__gte=start_date ) # Filter by end date query = query

Android TimeZone.getAvailableIDs() producing strange strings

限于喜欢 提交于 2020-04-30 07:52:57
问题 I have an Android application which uses TimeZone.getAvailableIDs() to pull all available timezone ID strings. These IDs are saved to an ArrayList , as per the following: ArrayList<String> clocks = new ArrayList<>(); String[] ids = TimeZone.getAvailableIDs(); Collections.addAll(clocks, ids); This ArrayList is used later on to populate a ListView using my custom BaseAdapter. There are a few entries that aren't particularly informative and I don't want them in the list, such as: Etc/GMT+10

Android TimeZone.getAvailableIDs() producing strange strings

落爺英雄遲暮 提交于 2020-04-30 07:52:37
问题 I have an Android application which uses TimeZone.getAvailableIDs() to pull all available timezone ID strings. These IDs are saved to an ArrayList , as per the following: ArrayList<String> clocks = new ArrayList<>(); String[] ids = TimeZone.getAvailableIDs(); Collections.addAll(clocks, ids); This ArrayList is used later on to populate a ListView using my custom BaseAdapter. There are a few entries that aren't particularly informative and I don't want them in the list, such as: Etc/GMT+10

Android TimeZone.getAvailableIDs() producing strange strings

空扰寡人 提交于 2020-04-30 07:52:08
问题 I have an Android application which uses TimeZone.getAvailableIDs() to pull all available timezone ID strings. These IDs are saved to an ArrayList , as per the following: ArrayList<String> clocks = new ArrayList<>(); String[] ids = TimeZone.getAvailableIDs(); Collections.addAll(clocks, ids); This ArrayList is used later on to populate a ListView using my custom BaseAdapter. There are a few entries that aren't particularly informative and I don't want them in the list, such as: Etc/GMT+10

Supressing Warnings in scale_x_datetime

谁说胖子不能爱 提交于 2020-04-17 04:05:10
问题 This is not a duplicate since none of the methods in that putative duplicate apply here. None of them lead to the warning going away. In fact I got an answer here from Konrad below - use suppressMessages . In the link that is asserted as a possible duplicate, they suggest suppressWarnings , which does not work. After finally figuring out how to get R to use my timezone on the ggplot date axis correctly (found scale_x_datetime in a post here, before it was using my local timezone even though

Ruby - Sort MongoDB records by Timezone?

烂漫一生 提交于 2020-04-14 07:19:10
问题 I have a collection of documents with a geospatial index location: {lat:XX.XXXX, lng:XX.XXXX} . But I would like them to be outputted by TimeZone. I was thinking of converting geolocation to Timezone, and have an index based on that, but I'm not sure how to do that either, or if it'll be easier to use the geospatial index anyway. 回答1: The excellent answer Sim provided will let you do it all in your own code - but it does require a bit of overhead. If you just want to resolve the locations to

Can I make node.js Date always be in UTC/GMT?

≯℡__Kan透↙ 提交于 2020-04-07 17:40:54
问题 My app runs on Linux servers, where the time (naturally) set to UTC/GMT. However the app is developed on Mac desktops where the time is typically set to a local timezone. I could change every new Date() in my code to run: var date = new Date().getTime(); And thus ensure dates on the server are always GMT, but that seems inelegant. I understand previous versions of node used to always return UTC/GMT. Is there any way to bring this behavior back? Edit: Removed adding timezone offset to getTime(

how to change timezone in googlesheet?

一个人想着一个人 提交于 2020-04-07 06:38:33
问题 I have copied a script for: when you visit an url, with values ​​in the url: my googlesheet automatically fills with the values ​​hidden in the url in cell and on the same line: the date and time . Everything works except that the time is not that of my time zone. What should I change to have the time in my time zone? Thanks function doGet(e) { Logger.log( JSON.stringify(e) ); // view parameters var result = 'Ok'; // assume success if (e.parameter == 'undefined') { result = 'No Parameters'; }