|
How can I get DateTime.now in this format: "Wed, 05 Apr 2006 21:12:00 GMT" ?
/\ |_ E X E GG
|
|
|
|
|
|
For instance, you can use:
string const MY_LONG_FORMAT = "MM/dd/yy HH:mm:ss:ffff"
string output = DateTime.Now(MY_LONG_FORMAT);
Note that the above format is NOT the one you want; you'll need to look at the link I provided in the earlier post to see how to build your format string.
modified on Friday, December 28, 2007 3:48:36 AM
|
|
|
|
|
string output = DateTime.Now.ToString("MM/dd/yy HH:mm:ss:ffff");
it will also work
Becoming Programmer...
|
|
|
|
|
Please only use ISO 8601 compliant formats.
|
|
|
|
|
|
hi
how to get motherboard and hard-disk serial number
in C# code ?
than'k alot for any help
|
|
|
|
|
|
There's an article on this site, I don't remember it, but a search should bring it up.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
|
I'm coding a program that the user can enter names in both arabic and english languages .. Can i program it to change the input language automatically ? usually the user have to press alt + shift to change the input language . i want the cursor to change to arabic when arabic names is need and to change to english else where ...
P.S
My english is bad . sorry
|
|
|
|
|
Thanks to everybody I've found the solution
using System.Globalization;
2)i decalre two CultureInfo one for the Deafult Language and the other to the second language (Arabic in my case)
CultureInfo arabic = new CultureInfo("ar-QA", false);
CultureInfo english = new CultureInfo("en-US", false);
2) in the focus enter event of the desired textbox i added the following code
private void txtName_Enter(object sender, EventArgs e)
{
InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(arabic);
}
so the language change to Arabic .
3) in the focus leave event of the same textbox i added
private void txtName_Leave(object sender, EventArgs e)
{
InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(english);
}
so the language returned to the default input language.
Thanks and i hope the explanation is enough.
Asaad Al Chalabi
abushalabi@hotmail.com
|
|
|
|
|
Cool deal finding the solution
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Thank you very much for sharing this solution with us.
Best Regards
Tarik
|
|
|
|
|
Thanks.
I have been searching for a code snippet like that, because I wanted to have a Google Chrome plugin that indetifies the input field in focus, and changes the windows language.
e.g. switch automatically to Arabic when cursor is at "Name" field, and switch to English when cursor is at "Email" field.
Does anyone know how I can use this code in a Google Chrome plugin?
Does it support activating any windows native (binary) programs as part of plugins?
|
|
|
|
|
private void butDelete_Click(object sender, EventArgs e)
{
try
{
OleDbCommand deleteNode = new OleDbCommand("", dbProfiles);
{
//Check if the selectedNode is not root node.
//I have changed the code below to make the checkbox delete the child node and not the root node. Is //there anything else I need to add??
if (tvFavorites.SelectedNode.Tag == null && tvFavorites.SelectedNode.Checked == true)
{
if (MessageBox.Show("Do you want to delete the \"" + tvFavorites.SelectedNode.Text + "\" folder and all its files?", "Delete Folder", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
deleteNode.CommandText = "delete from favFiles where folder_id = " + tvFavorites.SelectedNode.Name;
if (dbProfiles.State == ConnectionState.Closed)
dbProfiles.Open();
deleteNode.ExecuteNonQuery();
deleteNode.CommandText = "delete from favFolders where folder_id = " + tvFavorites.SelectedNode.Name;
deleteNode.ExecuteNonQuery();
dbProfiles.Close();
tvFavorites.Nodes.Remove(tvFavorites.SelectedNode);
}
}
|
|
|
|
|
Hard to tell without having the rest.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I want to print some things using a Mobile Pro Spectrum printer from an Optimus_PDA device. I work in c# .NET2005 please help me I want the correct dll I had Downloaded alot of them but it doesn't working .
So if some one help me by send me the correct dll or give ma an example I will be very thankful to him/her.
Bye Merry Christmas.
|
|
|
|
|
I have a single PDF file that I would like to split into several separate PDF files.
The main PDF consists of reports with store sales information. Each report may be 1 - 3 pages long, and each one has the word "Studio: " at the top.
I am wondering if I can search the main PDF for the word "Studio: ", grab everything that shows up after it (up to the next occurrance of "Studio: "), and stick it in a separate PDF file. Then I would repeat this process until the end of the file.
I tried opening one of my PDF files up in Notepad to see how it was layed out, but it is completely unreadable. It looks like the file is encrypted in some way. If this wasn't the case, I would just do a simple parse as though it were a TXT file.
Any ideas?
Thanks
|
|
|
|
|
It's not encrypted, PDF is a proprietary format so you'll need a third party library to read/write one of them. A quick google turned up this[^] page which might help you find one to fit your needs.
|
|
|
|
|
i want to convert Byte array into hex string
now i am using for loop to convert byte to hex and append to string
but it takes very long time for large file.
plz give me solution for fast conversion.
|
|
|
|
|
Hi,
show your code and we could tell you if and how it could be improved.
it takes very long time for large file
What is large?
did you:
- keep concatenating to a string (instead of using a StringBuilder)?
- run in release mode?
|
|
|
|
|
piyush1230 wrote: and append to string
You can't append anything to a string. Strings are immutable, so if you add something to the end of a string, a completely new string object is created and the data is copied to the new object. If you do this in a loop, it scales very badly. Each iteration roughly doubles the execution time, so it gets very bad very fast.
Use a StringBuilder to create the string:
StringBuilder builder = new StringBuilder(someArray.Length * 2);
foreach (byte b in someArray) {
builder.Append(b.ToString("x2"));
}
string hexString = builder.ToString();
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
StreamReader sr = File.OpenText(pth);
str = sr.ReadToEnd();
byte[] m_abyData = new byte[str.Length];
int iPos = (0 / 3);
int iLen = (str.Length < (str.Length - iPos)) ? str.Length : (str.Length - iPos);
for (int i = 0; i < iLen; i++)
{
m_abyData[i] = (byte)str[i];
sbVar.Append(string.Format("{0:X2}", m_abyData[i]));
}
this is my actual code.
but it takes very long time for large file.(large in size).
e.g 70,000 kb it takes very long time.
|
|
|
|
|
i have create an application in C# i need to create strong name in VS 2005 in command prompt .my sdk command prompt is like C:\Program files\Microsoft visual studio 8\SDK\v2.0 after this how to create strong name in VS 2005.help me to get this
Dhilip.K.K.
|
|
|
|