w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Ace editor doesn't format the data inside the editor div
Ace doesn't support formatting the code, you can either use beautify.js or browsers built-in json formatter var val = editor.session.getValue() var o = JSON.parse(val) // may throw if json is malformed val = JSON.stringify(o, null, 4) // 4 is the indent size editor.session.setValue(val)

Categories : Javascript

Covert c# datetime format to java datetime format
Your format string doesn't match the input date string : // 2013-07-03T19:16:02.3694 <-- date string static SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); You need to first parse the date string using the SimpleDateFormat with pattern yyyy-MM-dd'T'HH:mm:ss.SSSSSS and then you can format the Date object with dd-MM-YYYY pattern.Remember MM is for months , mm stands for minutes. String formattedDate = new SimpleDateFormat("dd-MM-YYYY").format( new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS") .parse(reportItem.getString("AddedTime")));

Categories : C#

How to customize the WPF Ribbon 4.5 (styles, templates, etc.)
You can change a couple of colors by setting properties on the ribbon: <ribbon:Ribbon x:Name="Ribbon" Background="Khaki" BorderBrush="Brown" MouseOverBackground="LightCoral" MouseOverBorderBrush="Coral" PressedBackground="LightGreen" PressedBorderBrush="Green" CheckedBackground="LightBlue" CheckedBorderBrush="Blue" FocusedBackground="LightSlateGray" FocusedBorderBrush="SlateBlue"> Not exactly a good-looking example, but shows how to do it. Would be interested how to do a complete re-styling as well...

Categories : C#

Customize Scaffolding templates list
how we could add the Scaffold environment so that it will be available in "Scaffolding options" of Add Controller dialog box?

Categories : Misc

format string in datetime c# to insert in MYSQL datetime column
Your line: string time = Convert.ToDateTime("10-10-2014 15:00:00"); Shouldn't compile. I can only guess that you don't have DateTime as type of your column in SQL Server, you should modify it to keep DateTime and then pass a DateTime type object, not a string.

Categories : C#

Adding date or time in datetime format to another datetime
*This is a method using DateTime:* $begin = new DateTime($start); $finish = new DateTime($end); $difference = $finish->format('U') - $begin->format('U'); // working version $minutesDiff = round(($difference/60), 0); $finalDate = new DateTime(); $finalDate->modify(sprintf('+%s minutes', $minutesDiff)); edit added missing bracket edit2 version without ->diff() method

Categories : PHP

Sql query for CONVERT datetime to a different datetime Format in SQL 2005?
http://msdn.microsoft.com/en-us/library/ms187928.aspx check out see Microsoft's explanation on date formats the one you're looking for is 20 or 120 BTW, you should supply with varchar with a number like this varchar(10)

Categories : SQL

Unity Interception (AOP) slowing down MVC Editor Templates
It seems like you are adding the interception extension multiple times in the loop. Can't check it now as I don't have compiler at hand but it certainly is not necessary. The question is - could this be the source of your slowdown? (Posted as an answer as suggested by the OP after a short discussion)

Categories : C#

Shared Editor Templates based on property names?
Create a ViewModel that holds onto the SelectList and the property you wish to bind to: public class ManufacturerListViewModel { public SelectList ManufacturerList { get; set; } public string ManufacturerName { get; set; } } Then the Editor Template: @model ManufacturerListModel @Html.DropDownListFor(model => model.ManufacturerName, Model.ManufacturerList) Then call it in your Views: @Html.EditorFor(model => model.Manufacturer)

Categories : Asp Net Mvc

ASP.NET MVC editor templates and Html.EditorFor(...) - how to disambiguate the type name?
You don't necessarily have to use the conventions. You can have your own template names. Like this, @Html.EditorFor(model => model.Prop1,"TheType_1") @Html.EditorFor(model => model.Prop2,"TheType_2") where "TheType_1" & "TheType_2" are the different template names for different types. This is one of six different overload methods available.

Categories : Asp Net

Entity Framework model binding/editor templates
public ActionResult Create(Article article) { if (ModelState.IsValid) { db.Articles.Add(article); db.SaveChanges(); article = db.Articles.Include(x => x.Tags).Where(x => x.ArticleID == article.ArticleID).First(); var Articleedtags = Request["Keywords"].Replace(", ", ",").Split(',').ToList(); Articletags.ForEach(tag => Article.Tags.Add(db.Tags.SingleOrDefault(x => x.Text == tag) ?? db.Tags.Add(new Tag { Text = tag }))); db.SaveChanges(); return RedirectToAction("Index"); } return View(Article); }

Categories : Asp Net Mvc

customize highcharts tooltip to show datetime
You can use moment.js to get the values formatted, but Highcharts has it's own date formatting functionality which would be more idiomatic with Highcharts. It can be attached onto the tooltip option in the highcharts constructor like so: tooltip: { formatter: function() { return '<b>' + this.series.name +'</b><br/>' + Highcharts.dateFormat('%e - %b - %Y', new Date(this.x)) + ' date, ' + this.y + ' Kg.'; } } You may want to also add the dateTimeLabelFormats object with the options you need for your dates, under the xAxis. I did this example with your code

Categories : Javascript

UIHInt template conflicts with defautl editor templates MVC4
I dont know why this error is coming, can somebody advise? Use the appropriate model type in your DFDateTime.cshtml template: @model DateTimeOffset ...

Categories : Asp Net Mvc

How to convert SCORM 2004 session_time format to a usable datetime format in SQL
Just worked out a solution for me. This would need to be put inside a SQL function for me and I would need to finish off the last bit where I decide what format I want. I am only updating around 900 rows and it is a 1 off update so performance isn't an issue. DECLARE @session_time varchar(200) = 'P50Y2M3DT4H5M6S' DECLARE @date varchar(100) = '' DECLARE @time varchar(100) = '' DECLARE @year varchar(20) = '0' DECLARE @month varchar(20) = '0' DECLARE @day varchar(20) = '0' DECLARE @hour varchar(20) = '0' DECLARE @minute varchar(20) = '0' DECLARE @second varchar(20) = '0' -- Remove the P SET @session_time = SUBSTRING(@session_time, 2, LEN(@session_time)-1) -- If we have a T IF PATINDEX('%T%',@session_time) > 0 BEGIN SET @date = SUBSTRING(@session_time, 0, PATINDEX('%T%',@session_

Categories : PHP

asp.net DetailView datetime field format doesn't match the SQL Server format
Check Your PC Date format and enter date of same format in due date if you enters the date time dynamically then use like this DateTime.Now.ToString(yyyy-MM-dd) here yyyy-MM-dd is my date format enter yours format in this and this is for current date you can use it for the date you desired

Categories : C#

Convert Datetime format to varchar format style workaround
Well you can convert both Dates in any format before you compare the two just use any of these: run this and you can select from them, make sure to convert both dates before Comparing Select convert(varchar, GetDate(), 100) as '100 Conversion', convert(varchar, GetDate(), 101) as '101 Conversion', convert(varchar, GetDate(), 102) as '102 Conversion', convert(varchar, GetDate(), 103) as '103 Conversion', convert(varchar, GetDate(), 104) as '104 Conversion', convert(varchar, GetDate(), 105) as '105 Conversion', convert(varchar, GetDate(), 106) as '106 Conversion', convert(varchar, GetDate(), 107) as '107 Conversion', convert(varchar, GetDate(), 108) as '108 Conversion', convert(varchar, GetDate(), 109) as '109 C

Categories : SQL

timezone aware datetime for django using templates
I just got here accidentally googling for a related problem, but I thought I'd answer, just in case someone finds it as well... What you were after didn't work, because localtime means the local time on the server (expressed in the timezone as defined in your settings). The django app running on the server has no way of figuring out what the client's timezone is. You should detect the timezone in the browser, e.g. using jstz. A more robust solution is to let the users choose their own timezone, but also setting the selection using autodetection (so that most of the time they can just press OK). Then of course you can store this on the server and from that point on, you can generate your templates using the user's timezone: {% loadtz %} {% timezone user.timezone %} ..... {% endtimezone

Categories : Python

DateTime to XML format but keep the datatype as datetime
The dateTime object holds the date and time in a way that is independent of any formatting. The output format is chosen when you convert the value to a string. If it comes out as dd:mm:yyyy, that's because it's defaulting to the format used by the country/language configured for your machine. So the answer is, if you want the ISO format (which you refer to as XML format), then the time to request this is at the time you output the dateTime as XML; it's not a property of the date/time value itself.

Categories : C#

How to customize log format in git?
Add following in your alias block in .git/config lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

Categories : GIT

Javascript datetime format in database format
dateToString : function (unformatted) { if (!unformatted) { return null; } var year = unformatted.getFullYear(); var month = unformatted.getMonth() + 1; var day = unformatted.getDate(); if (month < 10) { month = '0' + month; } if (day < 10) { day = '0' + day; } return [year, month, day].join('-'); } feel free to add time formatting

Categories : Javascript

Get custom datetime format from standard format
Here's some code do get the patterns: var c = new CultureInfo("fr-FR"); Console.WriteLine(c.DateTimeFormat.LongDatePattern); Console.WriteLine(c.DateTimeFormat.ShortDatePattern); Console.WriteLine(c.DateTimeFormat.FullDateTimePattern); The result from a console app is the following dddd d MMMM yyyy dd/MM/yyyy dddd d MMMM yyyy HH:mm:ss

Categories : C#

how to change date format of datetime format in php
I'd certainly hope that date values aren't actually stored in a textual format at all, any more than numbers are. It's a bit like asking the database to store numbers as hex instead of decimal. You should separate the inherent values within the data from the textual format applied to them when you present them. Normally I'd recommend formatting the data at the client side instead (which typically has more user context) but you can specify a format in the SELECT statement as well: SELECT DATE_FORMAT(StartDate, '%d-%m-%y') FROM SomeTable Likewise when inserting or updating data, I would try to use parameterized SQL so that you don't specify dates as text at all - normally the client library should be able to pass the data on to the database in a native binary format. In general, you sho

Categories : PHP

MVC4 Kendo Grid DateTime template editor
I have an MVC kendo-ui grid in one of my projects and it works just fine with the date in edit mode. What I noticed as different from your code was that I didn't write any attributes on the DateTime property in the model. My model simply looked like this: public class TransactionViewModel { [Key] public int TransactionId { get; set; } public string Description { get; set; } [Required] public DateTime TransactionDate { get; set; } [Required] public decimal Amount { get; set; } } In the grid I bound the column in the following way: columns.Bound(p => p.TransactionDate).Title("Date").Format("{0:yyyy-MM-dd}").EditorTemplateName("TransactionDate"); And, even though my editor template looked a bit different than yours, the code you provided worked just fin

Categories : Asp Net Mvc

Formatting preview of DateTime-column in XamDataGrid when editor is XamComboEditor
I have been looking into this, but I wasn’t able to reproduce your behavior. I used the following Format “dd-MMM” and it works as expected. Could you please try to set the format like this and see if it works for you? Also I found this post duplicate to the one in Infragistics' forum: http://www.infragistics.com/community/forums/p/83648/417940.aspx which is already discussed. In the future I can suugest you post your questions related to Infragistics controls there, because this way you will get an answer from an Infragistics expert.

Categories : C#

How to use DateTimePicker control for datetime field in Orchard editor (without adding datetimefieldpart)?
It is not necessary or even possible to add all datetime properties as parts: only one part of a given type can exist on a type. You could do it through fields however. What you need to do in order to reproduce the UI of the date field in your own part is to reproduce the template and script that they use, in your own part templates.

Categories : Asp Net Mvc

Format all numbers the same way in velocity templates
I must say that its not clear what "velocity template" is. But, there is a common way for number formating java.text.NumberFormat: Locale locale = Locale.getDefault(); //or any other locale, e.g. = new Locale("en", "us"); NumberFormat nf = NumberFormat.getInstance(locale); you can then set settings: mf.setMaximumFractionDigits(2); nf.setMinimumFractionDigits(1); nf.setRoundingMode(RoundingMode.HALF_UP); And then, when you otuput result: nf.format(number);

Categories : Java

4 Divs that would have to be aligned in the following format with django templates
I would use forloop.counter in some way, like this: {% for x in some_collection %} {% if forloop.counter < half_of_collection_count %} <div style="float:left;"> {%else%} <div style="margin-left:200px;"> {%endif%} content </div> Of course, you'll have to change the style of the diff according to your needs. Hope this helps!

Categories : Django

MVC 4 Editor Template for Displaying Time in HH:mm Format
After reading this MVC 3 - Html.EditorFor seems to cache old values after $.ajax call , I realized that before binding, HtmlHelper will look into ModelState. Not sure what is the intention/benefit of checking the ModelState, instead of binding what ever the value supplied. However I added this code in my controller before setting the value. Now it works fine. ModelState.Remove("StartTime"); ModelState.Remove("EndTime"); bookingViewModel.StartTime = Convert.ToDateTime(startTime); bookingViewModel.EndTime = Convert.ToDateTime(endTime); return View("Booking", bookingViewModel);

Categories : C#

Turning off VBA editor auto-format of code lines
Debug.Print does not have an option named --no-newline. So when the VB Editor encounters the line you tried, it (incorrectly) guesses you want a subtraction and adjusts the code line based on that guess. The unquoted semicolon after the text you want to Debug.Print is what actually suppresses the new line. Consider this procedure ... Public Sub PrintWithoutNewline() Debug.Print "A"; Debug.Print "B"; End Sub Calling that procedure in the Immediate window prints "AB" on one line, and leaves the insertion point (cursor) at the end of that line instead of at the start of a new line. PrintWithoutNewline AB

Categories : Vba

Tinymce toggle format, formats the button not the editor
I had similar issues. I guess your are using the inline edit option. When you click outside of the edit field the tinymce id deactivated. You could solve this issue by two methods: You could customize the toolbar and add you required formats in the toolbar On tinymce blur event store the range using rangy library. On the button click first activate tinymce, restore the saved range and then use tinymce formatter to toggle the style Hope this helps.

Categories : Javascript

Format DateTime
Try to use this (in your hibernateObject class): @Temporal(TemporalType.TIMESTAMP) @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") public Date getStartDate() { return startDate; } public void setStartDate(Date startDate) { this.startDate = startDate; } When you do as you show date object actually has no changes. Only thing that happens: you create String that contains formatted date. So you can specify DateTimeFormat pattern to store date in that pattern instead. Also note, that "hh" string in your date pattern actually will give you value from 1 to 12. It is AM/PM hour. To get 0-24 hours value use "HH" instead (see http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html, "Date and Time Patterns" section)

Categories : Java

DateTime Format for .NET
var res = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture); Read Standard Date and Time Format Strings On MSDN for more information Below is another way of achieving same format Console.WriteLine(date1.ToString("G", CultureInfo.CreateSpecificCulture("en-us"))); // Displays 4/10/2008 6:30:00 AM

Categories : C#

How do I convert string date format to datetime date format?
This should do it: SELECT CONVERT(DATETIME, REPLACE('Sept. 23, 2013','.',''), 107) This removes dot in string and converts to datetime format 107. And this returns the string you wanted (MM/DD/YYYY): SELECT CONVERT(VARCHAR(10), CONVERT(DATETIME, REPLACE('Sept. 23, 2013','.',''), 107), 101) For other format types see: http://www.sqlusa.com/bestpractices/datetimeconversion/ and http://www.sql-server-helper.com/tips/date-formats.aspx Edit: It turns out it works for me because of Slovenian locale (Sept.). This one should work in English locale: SELECT CONVERT(VARCHAR(10), CONVERT(DATETIME, SUBSTRING('Sept. 23, 2013', 0, 4) + ' ' + SUBSTRING('Sept. 23, 2013',6,9), 107), 101) As a function.

Categories : Asp Net

DateTime Format Handling
You can use ParseExact DateTime.ParseExact(datestring, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture); you already know format so you can go for this, but make sure the string is in same format and never changes.

Categories : C#

DateTime is not in proper format
There's several ways to do this. Either: Change the regional settings for the user running your web application Use the correct CultureInfo object when formatting Set the default CultureInfo object on the current thread Escape the slashes To provide a CultureInfo object when formatting: @Html.DisplayFor(modelItem => item.EndDate.ToString("dd/MM/yyyy", CultureInfo.GetCulture("en-US"))) To set the default CultureInfo object: Thread.CurrentThread.CurrentCulture = CultureInfo.GetCulture("en-US"); To escape the slashes, use single quotes: [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd'/'MM'/'yyyy}")] Note that all the code ends up in DateTime.ToString(string) or one of its overloads, so that's the place to look for clues to this.

Categories : C#

Format this datetime without seconds or AM/PM
You are looking for a custom Date and Time format. Try this: MyDateTime.Value.ToString("HH:mm")

Categories : Asp Net

C Sharp DateTime Format
Edited To Note: This looks to be a bug with Windows 7. When changing the short date pattern via the control panel, using the "additional settings" tab as in the OP's post, both the CurrentCulture and CurrentUICulture's date separator gets changed as well. When you modify the short date format, it looks like the first non-format character is picked up as the date separator for the current culture. Both CurrentCulture and CUrrentUiCulture are modified to reflect that [unintended] customization. Looks like some [bright] developer made the [unwarranted] assumption that nobody would ever have a short date format that included something like day of the week. Nice catch! Are you going to report the bug to Microsoft? If you use the invariant culture to format dates, etc., user settings won't af

Categories : C#

MVC DateTime format can not be parsed
This is a tricky area. There are many factors involved. One of the reasons can be that the web browser is set for US english. How about setting the culture information of the thread. You can do it either using Thread.CurrentThread.CurrentCulture or in the web config <globalization enableClientBasedCulture="true" culture="auto:en-NZ" uiCulture="auto:en"/> .

Categories : Asp Net Mvc

Can't change DATETIME format
Use DATE_FORMAT(date, format): DATE_FORMAT(s.date,'%d-%m-%Y')

Categories : PHP

DateTime input format?
Running that in debug mode, I get the following conversion failure: ConvertBack cannot convert value '30/01/2013' (type 'String'). BindingExpression:Path=Date; DataItem='MainWindowViewModel' (HashCode=19342748); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String') FormatException:'System.FormatException: String was not recognized as a valid DateTime. It looks like it uses a default converter which uses something along the lines of DateTime.Parse. The following fails with the same exception: var date = DateTime.Parse("30/01/2013"); It looks like your only options is to write your own converter.

Categories : Wpf



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.