datetime-format

What does DateTimeStyles.RoundtripKind enumeration mean?

泪湿孤枕 提交于 2019-12-04 16:26:28
问题 I was reading into answerer's post here where I ran into this enumerator DateTimeStyles.RoundtripKind which I'm trying to understand. I looked into MSDN here which says: The DateTimeKind field of a date is preserved when a DateTime object is converted to a string using the "o" or "r" standard format specifier, and the string is then converted back to a DateTime object. The timestamp in the input in the post I referred is like this: <timestamp time='2016-09-16T13:45:30'> I ran her code and it

Add the current time to a DateTime?

浪尽此生 提交于 2019-12-04 11:47:12
I have a string which represents a date, its given back from a DropDownList. The string is "27.08.2010" for example. Now I want to add the current time to this and parse it to Datetime ... so in the end it should be a DateTime like 27.08.2010 15:12:45 for example. How could I do this? Right now, I am putting together a string using DateTime.Now.Hour etc. and make a DateTime out of it, but that seems to be the wrong way. Thanks :) string s = "27.08.2010"; DateTime dt = DateTime.ParseExact(s, "dd.MM.yyyy", CultureInfo.InvariantCulture); DateTime result = dt.Add(DateTime.Now.TimeOfDay); You can

how do i use timezone in Twig date filter?

半腔热情 提交于 2019-12-04 10:06:27
I am using Twig and this date filter http://www.twig-project.org/doc/templates.html#date Apparently they are looking out for DateTime instances in the parameter. looking at this http://www.php.net/manual/en/datetime.construct.php I have trouble understanding the php datetime object and how to use the timezone. Given that i know basic PHP and is familiar with simple web programming, how do I use it to display a date and time using the Twig date filter while catering for timezone? If there is a simpler way to do it while using the date filter, but NOT using datetime object, i would be open to it

Convert string to date format in android

人盡茶涼 提交于 2019-12-04 09:09:14
问题 I'm trying to convert string to date format.I trying lot of ways to do that.But not successful. my string is "Jan 17, 2012". I want to convert this as " 2011-10-17". Could someone please tell me the way to do this? If you have any worked through examples, that would be a real help! 回答1: public class Utils { public static void main(String[] args) { String mytime="Jan 17, 2012"; SimpleDateFormat dateFormat = new SimpleDateFormat( "MMM dd, yyyy"); Date myDate = null; try { myDate = dateFormat

How to do formally correct parsing of ISO8601 date times in .Net?

爷,独闯天下 提交于 2019-12-04 07:42:41
There are many SO questions and answers regarding parsing of ISO8601 date/times in .NET and C#. However, there doesn't seem to be a 'definitive' answer anywhere, i.e. an answer that presents a formally correct ISO8601 parser that would correctly parse all of the possible format variants within ISO8601 and that would disallow non-ISO8601 variants. This SO answer is the closest match so far... How to create a .NET DateTime from ISO 8601 format Okay. Let's start with the limitations you are placing on ISO 8601 yourself: You want a DateTime, so all formats that only result in a time-of-day,

new Date() return a day before the day in date time string in javascript

守給你的承諾、 提交于 2019-12-04 06:19:38
问题 I have an existing date time string in place new Date('2014-08-01T00:00:00') But instead of returning 2014-08-01, it returns as 2014-07-31 in the actually angularJS view. I wonder is this date time string valid, if not, why its not valid. Could the T be the reason that the string return a wrong date? The console.log return a date of Thu Jul 31 2014 20:00:00 GMT-0400 (EDT) Thank You Lets call those -2 are toxic vote downs. They should really recall the days when they are struggling to

What is the culture neutral dateformat for SQL Server

雨燕双飞 提交于 2019-12-04 05:21:33
I have this question since the dawn of my programming career. Is there really a culture neutral format for datetime in sql server so that when ever I'm sending query string from a client side to the database server running sql server 2008 side having different system datetime format, and if the query contains a date converted to a string, what format would not give me an error. I recommend reading Tibor Karaszi's The ultimate guide to the datetime datatypes . If you input your date/time in unseparated or ISO 8601 format, then you should be fine with any configuration. Unseparated = 'yyyymmdd

Change System DateTime Format c#

陌路散爱 提交于 2019-12-04 05:20:00
问题 I need to change/update/set my system (windows7) default dateTime format programatically and permanently until I change it myself through code or through windows GUI I have tried a lot of solutions like this one from Code Project Console.Write(DateTime.Now + ""); RegistryKey rkey = Registry.CurrentUser.OpenSubKey(@" Control Panel\International", true); rkey.SetValue("sShortDate", "dd/MM/yyyy"); rkey.SetValue("sLongDate", "dd/MM/yyyy"); Console.Write(DateTime.Now + ""); The closest and well

SQL Server Datetime object persistent reformatting issue in Excel

三世轮回 提交于 2019-12-04 04:47:42
问题 I have an annoying issue working with SQL Server DATETIME objects in Excel 2013. The problem has been stated several times here in SO, and I know that the work around is to just reformat the DATETIME objects in Excel by doing this: Right click the cell Choose Format Cells Choose Custom In the Type: input field enter yyyy-mm-dd hh:mm:ss.000 This works fine BUT I loathe having to do this every time. Is there a permanent work around to this aside from creating macros? I need to maintain the

Date/Time Conversion ColdFusion

跟風遠走 提交于 2019-12-04 03:53:33
问题 I'm working with a script that displays the date and time in ISO 8601 format like so: 2012-05-17T17:35:44.000Z . but I would like it to display in the normal ColdFusion timestamp format when using the #Now()# notation ... so in this format: {ts '2012-05-17 17:35:44'} How can I do this? 回答1: As of CF 10, ISO-8601 is supported directly by parseDateTime. <cfset string = "1997-07-16T19:20:30+01:00"> <cfset date = parseDateTime(string, "yyyy-MM-dd'T'HH:mm:ssX")> Runnable Example on TryCF.com 回答2: