w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
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#

Convert GridView.DataSource with DateTime column to datatable
Try this way DataView dv=(DataView) from test in db.Tests select new { testId= test.TestId, courseName = test.Course.Name, onDate = test.OnDate, lastRegisterDate = test.LastRegisterDate }; gridAllTests.DataSource = dv; DataTable dt = new DataTable(); DataSourceSelectArguments args = new DataSourceSelectArguments(); DataView dv = new DataView(); dv = (DataView)dv.Select(args);// This SqlDataSourceObject means your sql query return object ,like dataset or datavi

Categories : C#

Custom field in SQLite SELECT query doesn't become DateTime column in DataTable after filling it?
Our team at work have been researching this issue for a long time. Our final conclusion is that any expression wrapping source field makes source data type unavailable. For ADO.NET providers using of expressions leads to System.Object final type, for ODBC provider it leads to System.String type. So it completely depends on data provider you use. Why does it behave in such way is a question to data provider developers (I haven't found the answer). By the way, .NET Framework provides a variety of tools to test whether given value is of type expected. There are only 5 basic data types in SQLite 3 (NULL, INTEGER, REAL, TEXT, BLOB). So in .NET code you can pass your value through the test for 3 most common types (INTEGER, REAL, TEXT).

Categories : C#

Loading DataTable from DataSet with correct column widths and format
A DataTable is an in-memory representation of a set of data. It has no width or format properties. If you are populating a, for example, DataGridView from the DataTable then this DataGridView or, more specifically, its rows or columns, have such properties. For example: DataGridViewColumn column = dataGridView1.Columns[0]; column.Width = 60; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; How to: Format Data in the Windows Forms DataGridView Control :MSDN

Categories : C#

get datatable row data & column in comma,pipe separated format
Try this: DataTable dtGraphOutput[0] = //Get DataTable Data ; foreach (DataColumn dcOutput in dtGraphOutput[0].Columns) { sTicketTypeCount +=dcOutput.ColumnName foreach (DataRow drOutput in dtGraphOutput[0].Rows) { sTicketTypeCount += ","+ dcOutput.ColumnName + Convert.ToString(drOutput[dcOutput]); } sTicketTypeCount += ((sTicketTypeCount == "") ? "" : "|"); } if you have problem with the last "|" you can remove it with a simple if

Categories : C#

Convert DateTime Column Format in DataSet from US/UK to US
You are creating the very problem you are attempting to solve. A DateTime does not carry any culture info or particular format. Neither do date and time data types in a database, such as datetime in SQL Server. When you convert it from DateTime to string - that's when you're using the culture info to apply a format. Then you are trying to use a different culture to parse the string in a different format and parse it back to a DateTime, where again it has no culture info. The simple answer then is - don't do this. To make it very clear - when you see output from your database in either SQL Management Studio, Visual Studio Debugger, or whatever environment you are using - that's not a DateTime. That's the string representation of the DateTime. Wherever you are looking will apply the

Categories : C#

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#

populating datetime value from php into Jquery Moble text input datetime-local
$(document).ready(function() { $("#datetime-1").val(<?php YOUR CODE ?>); $("#datetime-2").val(<?php YOUR CODE ?>); }); Its a bit hacky but it should work, just make sure the format of the date is what jq mobile is expecting.

Categories : PHP

Insert DataTable rows to DataBaseTables using DataAdapter: leave out one column in DataTable
string qry = "select * from PurchaseProduct where 0 = 1"; sa = new SqlDataAdapter(qry, conn); dataSet = new DataSet(); sa.Fill(dataSet); dataSet.Tables[0].Columns.Add("dtcolnPurchaseProductProductName",typeof(string));

Categories : Misc

adding results of query against datatable to a column in another datatable in visual basic
You can always nest that in another query: select *, datediff(ms, startDate, endTime) from ( <your existing query here> ) t And while I'm here, it seems you need a lesson in parameterized queries: Dim result As New DataTable Dim Sql As String = _ "SELECT *, datediff(ms, startDate, endTime) FROM (" & _ "SELECT ID, startDate, codeID, Param, " & _ "(select top 1 startDate from myTable " & _ "where ID= @ID and Param = mt.param and codeID = 82 and startDate >= @startDate and startDate >=mt.startDate " & _ "ORDER BY startDate) endTime " & _ " FROM myTable mt " & _ " WHERE ID = @ID AND startDate between @startDate AND @endDate AND codeID = 81" & _ ") t" Using cn As New SqlConnection("c

Categories : SQL

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

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

Make local urllib settings local?
Instead of using install_opener (which installs it globally), just call the open method of your opener object, and then transfer the results into a file. self.p_handler = urllib.request.ProxyHandler({'http' : self.proxy}) self.opener = urllib.request.build_opener(self.p_handler) result = self.opener.open(url) with open(filename, 'wb') as f: for chunk in iter(lambda: result.read(1024), ''): f.write(chunk) The last 2 lines here are just to avoid having to hold the entire file in memory; they allow it to stream through in kilobyte-sized chunks. If you don't mind having it in memory, the last bit gets simpler: result = self.opener.open(url) with open(filename, 'wb') as f: f.write(result.read())

Categories : Python

select column from datatable and convert this to datatable again
This will create a new table, insert the single column, and populate with rows containing original data: DataTable dt = new DataTable(); DataColumn column = new DataColumn() { ColumnName = defindedDataTable.Columns[0].ColumnName, DataType = defindedDataTable.Columns[0].DataType, Expression = defindedDataTable.Columns[0].Expression, ColumnMapping = defindedDataTable.Columns[0].ColumnMapping }; dt.Columns.Add(column); foreach (DataRow row in defindedDataTable.Rows) { DataRow newRow = dt.NewRow(); newRow[defindedDataTable.Columns[0].ColumnName] = row[defindedDataTable.Columns[0].ColumnName]; dt.Rows.Add(newRow); }

Categories : C#

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#

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

jquery datatable some settings don't work
I found the problem. My friend extends dataTable and this extensions corrupts the dataTable. Problem is $.extend(true, $.fn.dataTable.defaults, { "sDom": "<'collapse'<'row-fluid'<'span6'l><'span6'f>r>>t<'row-fluid'<'span6'i><'span6'p>>", "sPaginationType": "bootstrap", "oLanguage": { "sLengthMenu": "_MENU_ records per page" } });

Categories : Jquery

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

Rails Postgres - Datetime value won't save into Datetime column
Try putting these in the create method: logger.error params[:special_deal].class logger.error params[:special_deal].to_datetime or use the debugger to investigate them. It seems that it doesn't get converted properly to datetime. You will get a clear hint after this.

Categories : Ruby On Rails

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#

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

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

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#

Have multiple timeout(datetime) values per row in C# DataTable
First off, there are a few things you can do here to increase the speed. First off, datatables are meant to pull data from a database, and are not really high end collections. In general, Generic Lists are 4x faster than Datatables, and use significantly less memory. Also, your biggest time cost is coming from the DateTime.Parse right in the middle of your third loop, and performing the DateTime calculation right in the middle of the loop for your expiration time. It doesnt appear the expiration time is based upon the records original value, so you should definitely generate that once before the loop starts. I would recommend creating a data type for your record format, which would allow you to store the records dates as DateTime Objects, basically consuming the conversion time when yo

Categories : C#

Sorting on Column of datatable as alphabetically..or filter column
DataView dv = yourDataTable.DefaultView; dv.Sort = "Column2"; yourDataTable = dv.ToTable(); You don't need to add ASC, it's a default, unless you want DESC :) This code worked for me :)

Categories : C#

Maven local repository in settings.xml vs pom.xml
Though possible, personally I do not think that it is a good practice to do that. Depending on your usage this post will be helpful: http://blog.sonatype.com/people/2009/02/why-putting-repositories-in-your-poms-is-a-bad-idea. You also want a reproducible and portable project, this question discusses this related topic. Please don't check in those jars into your VCS just for portability sake! I will try to help if you still insist. To make your model to work, your "repo folder" must follow the structure defined here. Even though your "repo folder" is a local file structure, Maven will still treat it as if it is a remote repository, just like maven central. This means, whenever you are building your project, Maven will try to download the jars from your "repo folder" to your .m2 repository

Categories : Maven

local storage settings reset after every launch
2 things When you "Rebuild" the app, it will wipe out the isolated storage regardless of how you save it. You must make sure you are calling the save method on the storage object after you make your update. I am not sure if this applies Win Runtime, but that is usually the issue with windows phone storage. Hope this helps

Categories : C#

populate datatable from a local json file
Looks like the problem could be that your ajax is loading and setting the myObject variable but it is done after Datatables initialized so it does not get the updated myObject variable after your request has finished. You could do something like this to fix that: var myObject; $.ready(function(){ myObject={}; $.getJSON('http://localhost:8080/jsontext.json', function(data){ /* here I have tried using both the paths the c:pathjsontext.json and the one above */ myObject=data; $('#example').dataTable().fnAddData(myObject); }); });

Categories : Javascript

Insert Custom Data into a local DataTable
and the answer i found is : in msdn http://msdn.microsoft.com/en-us/library/tat996zc(v=vs.71).aspx dataTableName.Rows[0][ColumnName] = value; UPDATE (from another page of msdn http://msdn.microsoft.com/en-us/library/5ycd1034(v=vs.71).aspx) yourNewDataTable = existingDataTableFromDataBase.Clone(); yourNewDataTable.NewRow(); yourNewDataTable.Row[0/or in a For loop=> currentLoopIndex][columnName] = value;

Categories : C#

how to get notification when I changed the Region Format in Settings
Register for the NSCurrentLocaleDidChangeNotification notification. This will be called when the user returns to your app after the Region Format has changed. The UIApplicationSignificantTimeChangeNotification notification is for time changes, not locale changes.

Categories : IOS

*What* Java "security settings have blocked a local application from running"?
It was officially stated (Oracle's response to my school-team's email) that some older remains of virtual machines may actually cause security alerts with applets even if you set security settings to absolute minimum (had it many times with my applet). I guess it is a school/study work (as it is an applet), so it is probably worth trying to run it directly by appletviewer.

Categories : Java

Open Local Area Network (LAN) Settings window by code
I don't know if you could network settings because if you have more than one LAN including wireless ones which one you want to open? So, you better off opening the Network Connections settings instead and let the user decide which one to open. Thus you could use the code below to open Network Connection settings like: ProcessStartInfo startInfo = new ProcessStartInfo("NCPA.cpl"); startInfo.UseShellExecute = true; Process.Start(startInfo); Update: You could not call directly LAN Property Settings using any .cpl program. However, there is an unconventional way using your own code and by using SendKeys like this: System.Diagnostics.ProcessStartInfo proc = new System.Diagnostics.ProcessStartInfo(); proc.FileName = @"C:\Windows\System32\RunDll32.exe"; proc.Arguments = "shell32.dl

Categories : C#

how to split a xml format data into row column format in sql server 2008 using stored procedure
If you want to do it in SQL Server, you will have to write a .NET CLR stored procedure that reads your text string, split it by the '|' character and then insert/assign it to your table/object. See this article http://msdn.microsoft.com/en-us/library/5czye81z(v=vs.90).aspx

Categories : Sql Server

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#

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

ImportError: Could not import settings 'company.foo.settings' (Is it on sys.path?): No module named foo.settings
Have you tried setting the DJANGO_SETTINGS_MODULE environment variable to "company.foo.settings"? From the Djanjo Documentation; https://docs.djangoproject.com/en/dev/topics/settings/#designating-the-settings When you use Django, you have to tell it which settings you’re using. Do this by using an environment variable, DJANGO_SETTINGS_MODULE. The value of DJANGO_SETTINGS_MODULE should be in Python path syntax, e.g. mysite.settings. Note that the settings module should be on the Python import search path. EDIT: Can you also add the following to the top of your manage.py file? import sys sys.path.append('/path/to/folder/containing/company') EDIT2: In response to your clarification, you can try relative imports: http://www.python.org/dev/peps/pep-0328/#guido-s-decision

Categories : Python

How to format data in C# ASP.Net MVC for datatable.net ajax call
I assume you want to convert the datatable into json?? Please correct me if I m wrong. You can do it using json.net library: http://james.newtonking.com/projects/json-net.aspx string json = JsonConvert.SerializeObject(table, Formatting.Indented);

Categories : C#

Convert datetime to local python
you can use the useful dateutil package and the pytz one for exemple convert to paris timezone from dateutil import parser import pytz FR = pytz.timezone('Europe/Paris') # there is the summer offset changing in this zone date = parser.parse("2013-08-23T23:37:38+0000") datefr = date.astimezone(FR)

Categories : Python

Storing Utc and Local datetime in Mongo
This is the way I force MongoDB to store the raw value, and ignore the DateTimeKind attribute in DateTime object. This may not apply to your business logic, but make sense for us for our particular reasons. BsonSerializer.RegisterSerializer(typeof(DateTime), new MyMongoDBDateTimeSerializer()); public class MyMongoDBDateTimeSerializer : DateTimeSerializer { // MongoDB returns datetime as DateTimeKind.Utc, which cann't be used in our timezone conversion logic // We overwrite it to be DateTimeKind.Unspecified public override object Deserialize(MongoDB.Bson.IO.BsonReader bsonReader, System.Type nominalType, MongoDB.Bson.Serialization.IBsonSerializationOptions options) { var obj = base.Deserialize(bsonReader, nominalType, options); var dt = (DateTime) obj;

Categories : C#

Get local datetime formate In Jquery
You can change date format in jquery datepicker as such: var date = $('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' }).val(); This Link , Link and Link may be helpful.

Categories : Javascript



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