datetimeoffset

ColdFusion - DateTime Format with GMT offset

一曲冷凌霜 提交于 2019-12-13 15:25:39
问题 I am using ColdFusion 10 to make some REST calls and the date returned is using a GMT offset. Example: 2013-03-25T14:30:40-04:00 I need this formatted for 2 purposes: Screen Display so it looks something like mm/dd/yyyy hh:mm:ss To Insert into mySQL. I have tried a variety of the CF time/date functions but continue to get the "is not a valid date format" I thought maybe the #ParseDateTime(i.submitted_at,"pop")# would handle it with POP but same issue. Spent a few hours now trying multiple

ODBC connect to SQL Server 2016 with error Unknown data type -155

与世无争的帅哥 提交于 2019-12-13 04:09:44
问题 I've searched throughout the site and found the similar issue but with python not C#. Moreover, the workaround in that post (to avoid querying columns with DateTimeOffset datatype) did not help me since my application is slightly different. My MVC web application needs to list all tables in a SQL Server 2016 database dynamically. Then users can select 1 table from that list and display all columns and their values in a grid. I'm using ODBC with driver = {ODBC Driver 13 for SQL Server} to

Why UtcDateTime function is not adding the offset to the UTC date?

ぃ、小莉子 提交于 2019-12-13 04:04:07
问题 For instantaneous DateTime tracking, I am using a DateTimeOffset datatype. The following function adds the user corresponding TimeZone ID offset to the UTC DateTime property of DateTimeOffset According to the documentation, UtcDateTime will perform both a time zone conversion and a type conversion on a DateTimeOffset . The following code does not though. Why is the conversion not taking place? Function to add TimeSpan offset, public static DateTimeOffset GetUtcDateTime (DateTime

How do I stop the DateTimeOffset scale from causing a ChangeConflictException in linq to Sql?

拥有回忆 提交于 2019-12-12 18:13:11
问题 The following code tries to create a new record and then modify it after it has been committed to the database. The last SubmitChanges() call throws a ChangeConflictException. ItemA itemA = new ItemA(); itemA.Foo = "a"; itemA.Created = DateTimeOffset.Now.UtcDateTime; ItemAs.InsertOnSubmit(itemA); SubmitChanges(); itemA.Foo = "b"; SubmitChanges(); By examining the dataContext.ChangeConflicts I found that the 'Created' column was in conflict, even though the reported CurrentValue and

Change DateTimeOffset.Offset Property?

為{幸葍}努か 提交于 2019-12-12 17:42:16
问题 My end goal is to get universal time from client with NO offset - just UTC time. I try to accomplish this like so: Javascript: (new Date()).toUTCString() , the output of which logs: Thu, 17 Mar 2016 15:13:23 GMT , which is exactly what I need. Then I take it to server and try to convert it to DateTimeOffset : string dateTimeOffsetPattern = "ddd, dd MMM yyyy HH:mm:ss 'GMT'"; DateTimeOffset clientLoginTime = DateTimeOffset.ParseExact (timeStringFromClient, dateTimeOffsetPattern, CultureInfo

Adding hours and minutes to a date with javascript

冷暖自知 提交于 2019-12-12 14:35:15
问题 I am building a meeting calendar based on time zones around the world. My problem is how to add or subtract the time zone from the user selected date in Javascript. For example, on the select form, the user will select the date from a form: I would then get the results and convert to a date as below... var ldSelectDate = new Date(document.form1.year.value, document.form1.month.value, document.form1.day.value); I would like to add 12 midnight to this object. I then read in an XML that gets the

Create a DateTimeOffset set to Midnight in a different TimeZone from server

戏子无情 提交于 2019-12-12 13:28:39
问题 I have a server set to EST and am wondering what I need to do to create a DateTimeOffset set to Midnight of the current day but in a different timezone? For example PST? 回答1: Fetch the relevant TimeZoneInfo . Construct a DateTime which contains the local time (i.e. midnight) Call TimeZoneInfo.GetUtcOffset to find the offset from UTC Construct a DateTimeOffset with the local time and the offset (If Noda Time were production-ready, I'd suggest creating a ZonedDateTime using that, but

Storing a c# DateTimeOffset value in a SQL Server 2005 database

橙三吉。 提交于 2019-12-12 09:39:07
问题 I want to store a a c# DateTimeOffset value in a SQL Server 2005 database. Sql 2008 has this as a built-in-type, but SQL Server 2005 does not. The DateTimeOffset structure has a DateTime value wich I store as DateTime, an an Offset property (of type TimeSpan). Since this is the time zone relative to UTC, presumably it is usally at a whole number of hours or half-hours. Suggestions on how best to store this in a SQL Server 2005 database? 回答1: It's not a good idea to assume that an offset is a

How do I resolve issues with unsupported DateTimeOffsets in EF 6 using Sql Server?

泪湿孤枕 提交于 2019-12-12 09:18:57
问题 When I try to instantiate a DbContext I receive this message: System.NotSupportedException: There is no store type corresponding to the conceptual side type 'DateTimeOffset' of primitive type 'DateTimeOffset'. I am using Entity Framework version 6 on SQL Server. The constructor of the DbContext (with the line that throws the exception) looks like this: internal TestHubContext(string connectionStringName) : base(connectionStringName) { var objectContext = (this as IObjectContextAdapter)

Store DateTimeOffset in SQLite.Net

别等时光非礼了梦想. 提交于 2019-12-12 07:59:43
问题 In a WinRT (Windows 8.1 Store App) project, I'm using the SQLite.Net-PCL and SQLiteNetExtensions NuGet packages to store data in a local SQLite database file. Several of my data models (aka tables) contain properties of type DateTimeOffset . The aim is to store these without losing the offset information . (Reason for this is that the user can enter timezone information while specifying dates / times, and this information must be stored in the database.) I'm aware of the storeDateTimeAsTicks