|
See this:
Console.WriteLine(DateTime.Now.ToString("d", DateTimeFormatInfo.InvariantInfo));
|
|
|
|
|
If you look at the documentation it states that if the day is a single digit it will be returned as a single digit. I would think it doesn't matter how it is stored internally, but how it is displayed. If you want a day to be displayed with a leading zero, use "dd" in the format string.
Here is the link from the MS help files:
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconcustomdatetimeformatstrings.htm
HTH
Gandalf
|
|
|
|
|
use
string[] str=dt.Date.GetDateTimeFormats('d');
Take whatever the format you want from str array
Srini
|
|
|
|
|
I think the ToShortDateString does it automatically.
DateTime date = Convert.ToDateTime(strdt).ToShortDateString();
|
|
|
|
|
DateTime dt = DateTime.Parse(strdt);
Console.WriteLine(dt.ToString("MM/dd/yyyy"));
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
Hi,
Here is the c#.Net code:
TcpClient client = new TcpClient();
client.Connect(clientMc , 9333);
NetworkStream ns = client.GetStream();
Note: clientMc is string storing remote machine name as specified in hostfile.
Problem: If clientMc is localhost, the client is getting connected.
If clientMc is the name of other remote machine, it is not connecting and it is waiting over there.
Could you please suggest me?
Thanks
chintu
-- modified at 8:19 Wednesday 5th July, 2006
|
|
|
|
|
Do you have something listening on that port on the other machine? Are you getting an exception?
|
|
|
|
|
|
How to store sessions in first page in asp.net
and then how to retrieve sessions in the next page.
pl explain with an example
Further what is the differece between :Request.QueryString and Request.Form.explain with an example
how & when to write a cookie? explain with an example
Thank U 4 ur kind support
Arun
-- modified at 6:39 Wednesday 5th July, 2006
|
|
|
|
|
Sounds like you should break out your text book, and see if you can get this information from there. That's why it's called homework.
|
|
|
|
|
hi all,
how will i be sure that everything in buffer is read. nothing to read anymore?
i want to call a function after i read all data in serialport but dont know how i should code for check condition ?
help please,
bye.
|
|
|
|
|
If you know your end char of byte strem to read you can use the following code
<br />
SerialPort SPort = new SerialPort();<br />
char chCarriageReturn = '\n';
string strSerialPortReturnData="";<br />
int inReadchar;<br />
while ((inReadchar = SPort.ReadChar()) != Convert.ToInt16chCarriageReturn)) <br />
{<br />
strSerialPortReturnData += Convert.ToChar(inReadchar);<br />
}<br />
<br />
CallMethod(strSerialPortReturnData);
If you want to read All bytes that are there in the buffer use
SPort.ReadExisting()
Srini
|
|
|
|
|
i am developing an application in which i need to send sms messages from my asp.net application. i have googled a lot but to no avail..
Do anybody know the proper procedure to send an sms from asp.net application.
All responses are appreciated.
I need it urgent..
|
|
|
|
|
|
hi all,
how can i erase entire content of a file with C# ?
want that file as if its newly created ?
thanks, bye.
|
|
|
|
|
Just open it and save it.
StreamWriter s = new StreamWriter("test.txt");
s.Close();
|
|
|
|
|
<br />
File.Create (@"C:\Test.txt"); <br />
<br />
srini
|
|
|
|
|
hi,
I need some help regarding the loader lock exception in .net 2.0... I have a simple code which creates a new thread using threadstart delegate and creates a windows form in the thread and calls the show method of that form... the result is a loaderlock exception saying some unmanaged code is executed in managed area... has any body got something to say which could possibly solve the problem...
Thanks...
Regards,
Waqas.
|
|
|
|
|
hi all,
i am working on a windows application using c#.net .
the scenario of my problem is, i am havin two controls textbox and datagrid.the datagrid contains one column which has all the countries names. now whenever i type the countries name in the textbox the focus should go on to that countries name in the datagrid. and the row which contains the country should be shown as the first row. for example if we have denmark as the country the focus should go to this whenever i type this in the textbox and we should be able to scroll down the datagrid and show denmark as the first row in the datagrid.
can any one help.
regards,
sagar
|
|
|
|
|
Hi kids
Background
I'm writing a system service style application. It consists of a NotifyIcon in the sys'tray that has several functions that are called from the ContextMenu /Event s.
When the app' starts it should do nothing but sit there until the 'Start Sending' MenuItem 's Event is called. This event starts a new Thread which checks a file repository between Thread.Sleep(15*60*1000) .
Problem
To cut to the chase, the application is maxing out the cpu usage during a loop:
while(this.Created){<br />
Application.DoEvents();}
How to I prevent this excesive usage?
Do I need to access the System Idle Process?
This usage doesn't actually halt the server or even slow it down it just capitalizes the usage as there is no other contender for the cpu's attention. I have tried to drop the Thread.Priority to BelowNormal but the applications Thread remains at Normal in Task Manager.
-- modified at 5:41 Wednesday 5th July, 2006
|
|
|
|
|
Just make it sleep between the times it handles the messages:
while (this.Created) {<br />
Application.DoEvents();<br />
Thread.Sleep(100);<br />
}
---
b { font-weight: normal; }
|
|
|
|
|
I thought that too but it causes a crash, The problem is that Event s don't stack up between each Sleep so you have to click during the split second that Application.DoEvents(); is running
-- modified at 12:34 Thursday 6th July, 2006
Not to worry though, I found a solution
|
|
|
|
|
Yes, the messages are queued.
If the program crashes, there is something else that causes that.
---
b { font-weight: normal; }
|
|
|
|
|
How do i get information about all installed .net framework version? And On what framework my application is running?
Say I have application config file saying
<startup>
<supportedRuntime version="v1.0.3705" />
<supportedRuntime version="v1.1.4322" />
<supportedRuntime version="v2.0.50727" />
</startup>
So It will run on all the platform. Now, I want to check on which version its running and what all versions are installed on the system.
|
|
|
|
|
use
System.Environment.Version
Srini
|
|
|
|