datetimeoffset

How to Change time format of date string using timeoffset [duplicate]

筅森魡賤 提交于 2019-12-12 01:22:06
问题 This question already has answers here : Strange Java Timezone Date Conversion Problem (3 answers) Closed 10 months ago . I am trying to convert date string to UTC format from another time zone in Java. we have only time zone offset like "-06:00". Can any one help me how to convert the date time to UTC format using time zone offset. Thanks This for java version 1.7 . I have tried with following snippet but receiving the same input as output. String dateInString = "02/04/2019 18:17:15";

How can I get the actual datetime values from a SQLite table?

旧巷老猫 提交于 2019-12-11 19:29:48
问题 I am querying a SQLite table which has a DateTime member: public class PhotraxBaseData { [SQLite.PrimaryKey] [SQLite.AutoIncrement] public int Id { get; set; } . . . public DateTime dateTimeTaken { get; set; } . . . The records in the table contain dateTimeTaken values ranging from 2008 to 2014. None of the records contain a null or empty dateTimeTaken value. When queried via LINQPad, I get "2008-04-25 10:38:56" for this query: SELECT MIN(dateTimeTaken) FROM PhotraxBaseData ....and "2014-04

Rails change default timezone

偶尔善良 提交于 2019-12-11 14:09:38
问题 I'm trying to change default timezone in Rails 3.2.8 app to GMT+04:00, but I don't know how to do it. The following solutions do not work for me: config.time_zone = 'Moscow' config.time_zone = "(GMT+04:00) Moscow" config.active_record.default_timezone = 'Moscow' config.active_record.default_timezone = :local Also I've tried in rails console the following: ActiveSupport::TimeZone.all.map(&:name) wich returned a list of values, including "Moscow" . Time.zone returned (GMT+00:00) UTC wich is not

Parsing a DateTimeOffset string in C#

血红的双手。 提交于 2019-12-11 13:40:08
问题 I need parse datetimeoffsets from strings of multiple formats. One of the strings that fail is: 08/12/1992 07.00.00 -05:00 Now when I try to parse this, I use: DateTimeOffset.ParseExact("08/12/1992 07.00.00 -05:00", "dd/MM/yyyy HH:mm:ss zzz", CultureInfo.InvariantCulture) Which gives a FormatException : "String was not recognized as a valid DateTime." I can also try to add delimiters in the separators: DateTimeOffset.ParseExact("08/12/1992 07.00.00 -05:00", "dd'/'MM'/'yyyy HH':'mm':'ss zzz",

New DateTimeOffset from string

安稳与你 提交于 2019-12-11 08:04:33
问题 I want to create a new DateTimeOffset with offset = -5 from a string I do : string dt = "11082016"; DateTime date = DateTime.ParseExact(dt, "MMddyyyy", CultureInfo.InvariantCulture, DateTimeStyles.None); DateTimeOffset dto = new DateTimeOffset(date, TimeSpan.FromHours(-5)); Is it possible to create directly a DateTimeOffset without passing by DateTime ? 回答1: Is it possible to create directly a DateTimeOffset without passing by DateTime ? No, that's not possible. Every DateTimeOffset instance

In SSMS, display DateTimeOffset value in local timezone

纵饮孤独 提交于 2019-12-11 06:34:22
问题 Isn't there a way to configure Sql Server Management Studio to, in query results, display the value of a DateTimeOffset column in the client's local timezone, instead of UTC? Example: I'm in timezone +02:00. A value is stored as 2016-07-27 22:00:00.0000000 +00:00 . Currently, this value is displayed as such in query results. I want it to be displayed (formatted) as 2016-07-28 00:00:00.0000000 +02:00 when executing this query on SSMS on my machine. Currently I'm manually using something like

Javascript ASP.net date format without timezone info - timezone offsets

≯℡__Kan透↙ 提交于 2019-12-11 02:05:42
问题 I have a client side JavaScript that generates a date in JavaScript( new Date(2007,5,1) ). I need this date passed through to a hidden field that the code behind can access. My issue is that when the hidden field is converted into a DotNet datetime, the time is incorrect. This is because the JavaScript is including timezone info from the client browser. DotNet is then using this info to recalculate the time based on the difference between the server time and the client time. What i need from

Get time zone offset between two timezones for a given duration

余生颓废 提交于 2019-12-10 04:33:41
问题 I wanted to know if there is a way to get the time zone offset for a given date range between two timezones for a given duration. getTimezoneOffset(startDate,endDate,timezone1,timezone2){ ...missing magic to go here... } should return the time zone offset which is valid for the a given duration. However if the offset changes, it should return the date range for which it's valid. So I am looking at something like this: getTimezoneOFfset("march 9 12 am", "march 15 12 am", "UTC", "US/NEW_YORK")

Why does Json.NET DeserializeObject change the timezone to local time?

这一生的挚爱 提交于 2019-12-09 05:00:37
问题 I'm using json.net to deserialize a DateTimeOffset , but it is ignoring the specified timezone and converting the datetime to the local offset. For example, given var content = @"{""startDateTime"":""2012-07-19T14:30:00+09:30""}"; When deserialised using: var jsonSerializerSettings = new JsonSerializerSettings() { DateFormatHandling = DateFormatHandling.IsoDateFormat, DateParseHandling = DateParseHandling.DateTimeOffset, DateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind }; var obj =

Difference between 'DateTime' and 'DateTimeOffset' [duplicate]

南楼画角 提交于 2019-12-09 02:06:57
问题 This question already has answers here : When Would You Prefer DateTime Over DateTimeOffset (3 answers) Closed 5 years ago . What is difference between a DateTime and a DateTimeOffset object? And when should we use each one? In a web-application that may change the server's area, storing date and time. Which one is better, or is there any other suggestions? 回答1: DateTimeOffset Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Universal Time