C# - DateTime Is Being Interpreted As Two Different Formats?
Apr 3, 2011
I have an MVC application which allows appointment booking. The user can click on a slot in the diary view, which takes them to a page to select the practitioner and confirm.The query string for this page contains a DateTime which is the time the appointment is to start. This is automatically formatted in US format by Html.ActionLink(...), like so:
/assign?date=04%2F06%2F2011%2009%3A00%3A00
This is correctly deserialised and the view reports that the appointment time will be the 6th of April. It is also stored in a hidden field in the view to be posted to the confirm action; the hidden field has the value: 04/06/2011 09:00:00, rendered by Html.HiddenFor(...). Again, looks like US format.However, when the form gets posted, the appointment is booked for the 4th of June, presumably interpreting the date as en-GB.
View 1 Replies
Similar Messages:
Jun 10, 2010
I have a DateTime column in my SQL database, how do I check if the Day in that is Today, or yesterday?
What I want to is something like: If date is today then the result would be "Today, at " same for yesterday..
View 6 Replies
Oct 26, 2010
Why we say compiled code in ASP.NET using C# or VB.NET means high performance and in the other side the server controls make the website slower! so if we combine server controls + compiled code the result will be the same as other interpreted technologies, so where is the speed and performance in ASP.NET? From this point of viwe it seems to be the same as others technologies, right?
View 9 Replies
Aug 25, 2010
i m trying to save image to server by giving path,but error comes
"URI formats are not supported."
View 3 Replies
Aug 31, 2010
I'm starting to learn ASP.NET and going through the tutorial videos on www.asp.net. I understand the basic concept of web application frame works like ASP/PHP/ASP.NET. HTML/XHTML is created with special tags that the server knows to read and replace with content. I did a little bit with ASP during a summer internship back in the 90's.
Yet with the few examples of ASP.NET I've seen so far it seems ASP.NET has two types of server interpreted tags.
Most of the time I see <asp:XXXX > tags such as
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
but I also see regular ASP tags like
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="TailspinSpyWorks.SiteMaster" %>
What is the difference between these two tag formats? Both are interpreted by the server correct? Why would I use one over the other?
View 1 Replies
Jan 21, 2010
I created a UserControl and added a public DateTime property. I want to set this property in Markup (ie. <cc1:MyControl runat="server" id="MyControl1" DateTimeProp="1/1/2010" /> ) however I live in a place with a dd/mm/yyyy date format so it complains if I set something like "20/1/2010". Is there a way to set markup in my local datetime format or do I have to conform to "mm/dd/yyyy"?
View 2 Replies
Apr 1, 2011
I have a problem:
I've created usual Controller and View(Edit view) for editing my Entity (EntityFramework)
Here is view example:
<div class="editor-field">
@Html.EditorFor(model => model.BirthDate)
@Html.ValidationMessageFor(model => model.BirthDate)
</div>
BirthDate is Nullable<DateTime>
but during loading my View I get this exception
The model item passed into the dictionary is null, but this dictionary requires a non-null model item of type 'System.DateTime'.
That's because of BirthDate is null in database but it is nullable and I expect that it just leaves the filed empty.
And I have Shared EditorTemplate:
@model System.Nullable<System.DateTime>
@if (Model.HasValue)
View 2 Replies
Feb 9, 2010
I have an XML string which contains Dates formatted "dd/MM/yyyy hh:mm:ss".
I'm loading this XML into a dataset using DataSet.ReadXml().
How can I ensure that this Date is stored in the DataSet as a typed DateTime so that I can Sort, Format and RowFilter on it accordingly.
My test harness is as below:
ASPX Page:
[code]....
View 1 Replies
Jun 1, 2012
obj.From = DateTime.Parse(txtFrom.Text, ci);
And it will give error String was not recognized as a valid DateTime. How it can be solved..
View 1 Replies
Mar 2, 2011
In out project,We are looking for a third party .dll,which is able to convert different file formats into PDF as follows.
.doc,.docx to PDF
.xls,.xlsx to PDF
.ppt,.pptx to PDF
HTML to PDF
Images(.jpg,.jpeg,.tiff,.png and others) to PDF
.MPP to PDF
Merging of PDF files.
View 6 Replies
Mar 25, 2011
I created a page that allows our customers to print their ads that they have listed with us. All of their image information is stored in our DB as a url since we run on multiple servers. In order to get the image on the page, I download it as a temporary file and than draw it on the page.
Code:
Dim Images As Generic.List(Of VehicleImages) = vInfo.VehicleImages
Dim picture As String = ""
If Images.Count > 0 Then
picture = Images(0).ImageURL
End If
If picture <> "" Then
Dim pic As String = picture.Replace(Session("imageDomain"), Session("imageShareName")).Replace("/", "")
writeToLog("Picture Location: " & pic) *Add to catch possible error, not part of the issue*
Dim img As System.Drawing.Image = System.Drawing.Image.FromFile(pic)
Dim temppic As String = "*save path* emp_" & Date.Now.Ticks & ".jpeg"
img.Save(temppic)
System.IO.File.WriteAllText("D: emppdftester.txt", picture)
Dim imgNum As Int32 = pdf.AddImageFromFile(temppic, 0)
If imgNum = 0 Then
pdf.DrawText(LeftEdge, curY, "Couldn't load image")
curY += space + pdf.GetTextSize
Else
pdf.SelectImage(imgNum)
pdf.FitImage(LeftEdge, 180, 540, 260, 0, 0, 0)
curY += 200
End If
If System.IO.File.Exists(temppic) Then
System.IO.File.Delete(temppic)
End If
End If
The issue is that for one of our customers (not sure if there is more as noone has said anything), it errors on the bold line and the error is:
Quote:
Exception information:
Exception type: ArgumentException
Exception message: URI formats are not supported.
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
at System.IO.Path.GetFullPath(String path)
at System.Drawing.IntSecurity.UnsafeGetFullPath(String fileName)
at System.Drawing.IntSecurity.DemandReadFileIO(String fileName)
at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
at Dealers_Only_PrintVehicleAd.createPDFSelectable() in *filename*:line 213
at Dealers_Only_PrintVehicleAd.btnPrintAds_Click(Object sender, EventArgs e) in *filename*:line 46 *Line that calls the Sub*
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
View 4 Replies
Apr 4, 2011
I have a field that I display via:
String.Format({0:c},amount)
This produces the string "$28.28" However, when I try to convert back to a decimal amount, I get an incorrect format exception:
amount = Decimal.Parse(amount.Text, NumberStyles.Currency)
I also tried it with NumberStyles.AllowCurrencySymbol with the same results. I verified that the value in amount.Text is "$28.28". Am I missing something? Shouldn't these two operations use the same currency symbol and formats?
View 2 Replies
Aug 17, 2010
I have a ListView with about 10 rows. I have an item template for these rows and it is working correctly. I want to have two more rows in this ListView, but these rows do not match the item template as they have one more control in the first column.
The layout of the ListView is based on an HTML table with 10 rows and 4 columns. For example, the first 8 rows have only an ASP.NET TextBox control in the first column and 2 rows have in an ASP.NET TextBox control and an ASP.NET Label control in the first column.
View 2 Replies
Jun 2, 2010
How show local time in datagridview collumn DateTime from database with universal datetime
View 2 Replies
Sep 30, 2010
I am trying to store a SQL Server datetime into MySQL datetime field, but MySQL stores the date value as all zeros. I use this function to trim the fractional part from the SQL Server datetime, but get the same result when trying to store it in MySQL.
[Code]....
View 1 Replies
Nov 15, 2010
I am trying to get data from mysql database and store in sqlserver database. i am getting the following error
The given value of type MySqlDateTime from the data source cannot be converted to type datetime of the specified target column.
View 5 Replies
Jan 17, 2011
i want to format money in two formats
1) US dollors like this $126,765
2) is normal only seprate with comma when thousand occurs like this 126,765
View 5 Replies
Feb 10, 2010
i recently installed IIS SEO toolkit on my Windows 7 desktop and tried to run a SEO report for my web site [URL], based on a multi-lingual (greek, english) implementation of asp.net mvc 1. One of the violations reported, has to do with the fact that in my global.asax file, i have the default values "el-GR", "Home" and "Index" for the locale code, controller and action route parameters correspondingly. This way, the [URL] and the [URL] are reported to be acceced from the same url from the SEO toolkit, like shown below:
The page with URL [URL] can also be accessed by using URL [URL].
View 6 Replies
Jun 21, 2010
We have a business application where users can upload documents and where admins later review them. These admins want to print these documents, preferably by just ticking checkboxes in the file list form and clicking a "print button".
My problem is how to append the different documents, which of course can be of different formats, and send them to a printer in one go. I am currently thinking of converting them into a common format (like xps of pdf, or even good old PostScript) and send that file out. I have not yet found any conversion tools though.
Has anyone had any experience in these matters, and if so, what were your conclusions? Are there any good conversion tools out there, or am I going in the wrong direction?
View 2 Replies
Jul 29, 2010
I want to have a web form where i browse any kind of video format file and convert it into the anyother video format using asp.net.Is it possible using asp.net? If yes then how can i do that and what builtin or third party components / controls has to use.
View 8 Replies
Oct 6, 2010
Every date time format can be represented by a regular expression how can i get the a regular expression for a perticulat format?using .net API
View 3 Replies
Mar 14, 2012
I was trying to use code at this link... [URL] ....
I was able to successfully get the Excel export function working but there are issues with the CSV I am still troubleshooting.
My issue is this though. I have a Gridview of both English and other foreign languages such as Japanese and Thai. The foreign Asian languages do not export properly using your code. European languages such as Spanish, French and Italian have no problem. Do you have a fix to support the Asian languages?
View 1 Replies
Dec 4, 2010
What I want is..If culture is en-US then
string dateFormat="MM/dd/yyyy";
string timeFormat="24.00 hrs";
If culture is en-GB then string dateFormat="dd/mmyyyy";
string timeFormat="24.00 hrs";
and so on for other countries..Now how do I get these date and time format values ? What are the standards? Like which all countries use similar date/time formats and which ones don't ?ok I tried this :- DateTime myDate = new DateTime();
string us = myDate.ToString(new CultureInfo("en-US"));
string us gets value =1/1/0001 12:00:00 AM
Now how do I extract "dd/mm/yyyy" and "24.00 hrs" out of this...in my Dateformat column in my Table... I want to store STRINGS such as dd/mm/yyyy or mm/dd/yyyy NOT dates..In my TimeFormat column in the table, the values to be stores are STRINGS too, like I need to store either "24:00hrs" or "12:00hrs"
How do I do this now ?**using ShorTimePattern returns these values as h:mm tt and HH:mm
If I want to store the values in my DB exactly as "24:00hrs" and "12:00hrs", how do I use these values..h:mm tt and HH:mm,which one is for 24 hr format and which for 12 hr format ?**I want the information about Decimal Separator and Thousand Separator too based on the CultureInfo...whats the property for that ?
View 3 Replies
Mar 23, 2010
I have some WCF services that I want to return in different formats based on a querystring param. For example, [URL], [URL], [URL], etc... This would make it so that many different types of clients could consume the services whichever way was easiest for them, such as binary for a .NET client and json for an ajax or Flex client.
What I'm thinking is that I can have the WCF web methods return their .NET business objects and not worry about the output mode and then have a behavior that hooks in after returning from the web method which checks the querystring for this param and either:
1. Continues returning the business objects if the mode is dotnet.
2. Converts the business objects to xml if the mode is xml and returns a string of xml.
3. Converts the business objects to json if the mode is json and returns a string of json.
View 2 Replies
Mar 10, 2011
I'm looking for a .net component (Open source or commercial) which can convert all the major frequently used file formats to PDF without making use of a print driver. I'm looking for a support for the following file formats
MS word (doc, docx)
MS Excel (xls, xlsx)
MS PowerPoint (ppt, pptx)
Major Image formats
HTML to pdf
txt, rtf etc.
View 7 Replies