|
This code gives this result
MM/dd/yyyyHH:mm:ss
whithout space between Date and Time
|
|
|
|
|
Message Closed
modified 27-Apr-15 11:00am.
|
|
|
|
|
Custom DateTime Format Strings[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
try to use
lblLoginTime.Text = Convert.ToDateTime(DateTime.Now.Date.ToString()).ToString("MM/dd/yyyy"+" "+Convert.ToDateTime(DateTime.Now.TimeOfDay.ToString()).ToLongTimeString();
rahul
|
|
|
|
|
Just following your logic makes my brain ache!
DateTime.Now -> returns an instance of DateTime.
.Date -> gets JUSt the date part
.ToString() converts the DateTime instance to a string according to your PC settings
then:
Convert.ToDateTime(DateTime.Now.Date.ToString()) --> Convert a DateTime to a striing, then convert that string back to a dateTime..
and finally
ToString("MM/dd/yyyy hh:mm:ss") --> convert the whole lot back to a string.
How on earth did you come up with such a convoluted way of doing it? The reason you were getting just the date and 00:00:00 as the time is bacause thats exactly what you asked for by callin .Date on DateTime.Now
All you needed was:
DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")
and you would have got todays date and time in your required format.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Hi,
I have made a installer of My Windows Application (C# 2005 Express) and ported my software to a different computer. my installer installes SQL Server 2005 Express in the target machine at first then copy my software. When I installed the software in that computer and I clicked to run, I got the following error message and Program shut down.
.........................................................................
An error has occured while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the fact
that under the default settings SQL Server does not allow remote
connections. (Provider: SQL Netowrk Interfaces, error:26 - Error locating
Server/Instance specified.)
..........................................................................
Would you please guide me about this problem. Why it is looking for remote connection, It is not something like ASP.NET connecting thru Website or something like that. it is the very mdf file which is already available in the same PC and it should be accesssible thru the connection string I programmed in the application, right ?
Thanks and regards
Emran
|
|
|
|
|
Sounds like the SQL server isn't configured to allow incoming calls.
I'm not familiar with SQL Server 2005, but Oracle needs to have listenerservices running.
Might be a similar thing.
-Larantz-
|
|
|
|
|
Please help me...
I'd like to implement a depth first search method..
Or breadth first search,or both of them.
Please help me quickly...
|
|
|
|
|
Sounds like homework, or an examn maybe? ^^
-Larantz-
|
|
|
|
|
Best Regards,
Apurva Kaushal
|
|
|
|
|
It's not exaxtly homework,but i'll use it as small part in a big project...u can help me..
|
|
|
|
|
hi Al Friend
i Developing application by C#
i get All user in Domain by LDAP, i get user in Groups
But i dont know get Premission of that Groups
can some friend help me !
thanks
|
|
|
|
|
Dear friends,
Is it possible to bind the fields of structure to the controls on the form ?
For example.. i got a structure
struct Student
{
String firstName;
String lastName;
// and many other fields and properties
}
Now i got a *form* in which many text boxes are present related to the student. I am initializing form as follows;
txtBoxFirstName.text = student.firstName;
txtBoxLastName.text = student.lastName;
// and so on
Similarly when the form is dismissed, i read the changes back to the structure as:
student.firstName = txtBoxFirstName.text;
student.lastName = txtBoxLastName.text;
// and so on
Now, the problem is that the *Student* structure is very simple containing two fields, as such i need two text boxes on the form. But what if it contains 10 or 15 fields. As such i need to manually read each of the field value from the structure and displaying it in each of the edit controls. And then manually read changes from each edit control to the structure fields.
Is it possible to directly *bind* the strucute fields with the edit controls. It is very easy in ADO.NET. But i dont know whether it is possible in my case ?
Imtiaz
|
|
|
|
|
Can #define be used to define string constants as we do in C lang?
e.g. #define FIELD "Field"
the statement gives an error saying, "Single line comment or end of line expected"
Is this the limitation of the c# language ( no offences meant to c# gurus ) or is there any different systax to be used? Please help.
Thanking in advance.
-- modified at 2:28 Friday 26th May, 2006
|
|
|
|
|
abhijit pai wrote: Can #define be used to define string constants as we do in C lang?
No.
abhijit pai wrote: Is this the limitation of the c# language
It is not a weakness of the language - It is a strength of the language.
abhijit pai wrote: is there any different systax to be used?
Use a const to define values like this.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
It is not a weakness of the language - It is a strength of the language.
Since I* am a newbie to c# I do not undersatand how it is a strength.
Can you please kindly explain?
I will be very thankful to you.
|
|
|
|
|
Just use
const string myStr = "text";
-Larantz-
|
|
|
|
|
abhijit pai wrote: I do not undersatand how it is a strength.
Can you please kindly explain?
It is a strength because it forces you to use proper language constructs and to put strings and other values in to const s
For example in C++ you could put
#define MY_STRING "my_string"
SomeFunction(MY_STRING);
or worse
#define MY_INT 5+5
SomeFunction(MY_INT*MY_INT);
which expands out to SomeFunction(5+5*5+5); which is equivalent to SomeFunction(35); and not SomeFunction(100); which some might be expected.
in C# you put
const MY_STRING = "my_string"; or
const MY_INT = 5+5;
When you call SomeFunction(MY_INT*MY_INT) you get a value that makes sense.
using const s in C# is also type safe. So the compiler can show you easily what the problem is, if there is one. Preprocessor statements like #define are naturally evaluated before the compiler runs. This means that in C++ the defined values are expanded out in advance. If the compiler has a problem with some code it can only show you the expanded version, which may look quite different to the version you see in the IDE, since it never sees the version you see.
Does this help?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
it does help alot, but I would be thankful to u if can please provide more clarity on it or some link that would make it undersand me in depth.
|
|
|
|
|
What is to understand, it is a not supported feature - Use const s.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi friends,
I want to develop file monitoring system where I want to track down the files created by perticular process. I tried using FileSystemWatcher class to monitor drives\directories. But when any event occurs FileSysteWatcher fails to give any information about that process that has created/changed/deleted that file. It would be nice if somebody can help how to achieve this using c#!! Or I have to use some win32 apis to get this done? if so does anybody know about these APIs?
Hiren Suchak
-- modified at 1:52 Friday 26th May, 2006
|
|
|
|
|
To get the active sqlserver names
|
|
|
|
|
when i open a file stream, is it possible to start reading a specific line other than reading from the beginning to end?
|
|
|
|
|
No. The library has no way of knowing what a line is without walking through them, a newline is just another character ( well, two, but it's just data, there's no index ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi
i want to collect many files and create password protected self-extract file. how to do that ?
thanks ?
|
|
|
|