|
I want to format a DateTime value into a string. The thing is that I’m developing a Multilanguage application and I want to format the string according to the users culture.
For example:
Swedish: YYYY:MM:DD HH:mm
English: DD/MM/YYYY HH:mm
_____________________________
...and justice for all
|
|
|
|
|
I believe there's a ToString method that uses the local culture, or that takes the culture at least, so you can ask the system for it ).
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
DateTime.ToString("g")
made it for me.
_____________________________
...and justice for all
|
|
|
|
|
|
string myDate = DateTime.Now.ToString("dd/MM/YYYY HH:mm");
Why was this post voted a 1?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Wednesday, January 21, 2009 1:35 PM
|
|
|
|
|
Yeah, what they said, but you should only use ISO 8601-compliant date formats: yyyy-MM-dd HH:mm
|
|
|
|
|
How to implement kerberos authentication in ASP.net..
%$^
|
|
|
|
|
LMAO, your wasting your time with that one (I mean the question)
|
|
|
|
|
Does this LOOK like the ASP.NET forum to you ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: Does this LOOK like the ASP.NET forum to you ?
Sure it does - it's got orange bits at the top and the side and blue bits with questions in. Existentially, this could all be viewed as one big ASP.NET forum.
|
|
|
|
|
Good point..... you forgot the key thing, the url has aspx in it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
lachu009 wrote: How to implement kerberos authentication in ASP.net..
Well, you're hosed if you don't have a kerberos server.
|
|
|
|
|
Use Windows Authentication from a Windows Domain server.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
I created a client-server application where I installed the client on 10 computers in a network (LAN)... now since the IP address of each computer are dynamic.. I created my server in such a way that I will scan the network from something like 192.168.1.1 to 192.168.1.255 just to find those 10 computers. It works, it was able to detect the 10 computers which is running the specific service.. My problem is that the detection is too slow.. starts from 192.168.1.1 (30 seconds) then 192.168.1.2 (another 30 seconds) so like an average of 30 seconds for each IP... is there a way to fasten this up?
|
|
|
|
|
I'm not sure if there's a 'proper' way. Have you tried pinging the addresses first to see if they exist? I would be testing several at once using threading too.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I am only running the scan on a single thread and i'm planning to create more... Regarding the "detection" if the IP exists on the network... how do i do that? i used the Dns.getHostByAddress but it seems like it failed.
|
|
|
|
|
In the System.Net.NetworkInformation namespace, there is a Ping object, that can ping either an IP address, or a host-name (the name of the computer). Use the Ping.Send( string ) or Ping.Send( IPAddress ) methods and get a PingReply object with details about the host or address pinged. See
|
|
|
|
|
In the System.Net.NetworkInformation namespace, there is a Ping object, that can ping either an IP address, or a host-name (the name of the computer). Use the Ping.Send( string ) or Ping.Send( IPAddress ) methods and get a PingReply object with details about the host or address pinged.
See How to ping a hostname/ip using ASP.NET 2.0 and C# .NET[^] for an example of using the Ping and PingReply objects.
|
|
|
|
|
I use conditional compilation symbols to enable and disable client cusomised parts of my code.
Is there a built-in way to determine at run time what symbols were defined at build time?
|
|
|
|
|
Take five minutes and think again about your question, I think you already gave yourself the answer
The answer is "No". The IL does not contain any references to the code not compiled by the preprocessor directives.
Code like this:
#if DEBUG
Console.WriteLine("Debug");
#else
Console.WriteLine("Release");
#endif
will lead to following IL code:
L_0000: nop
L_0001: ldstr "Debug"
L_0006: call void [mscorlib]System.Console::WriteLine(string)
L_000b: nop
if compiled in debug mode, otherwise "Release".
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Sure, I realised I could engineer code to produce exactly that, but I wondered if it might have been built-in. Perhaps in the assembly meta data, and reflection would be able to find it. But I guess not.
thanks anyway
|
|
|
|
|
Certainly not automatically, but if it's important enough you could probably engineer a mechanism.
Something along these lines comes to mind:
public static readonly System.Collections.Generic.HashSet<string> DefinedOptions =
new System.Collections.Generic.HashSet<string>() ;
...
# if DEBUG
DefinedOptions.Add ( "DEBUG" ) ;
...
# endif
But that would only work where such statements are valid.
On the other hand, I question whether or not using conditional compilation is an appropriate technique for your requirement.
|
|
|
|
|
Hi all,
I am trying to create a custom toolstrip control, that will allow me to put in some toolstripbuttons that should display each time I make use of this control in a form. This way I don't have to recreate the toolstip over and over again.
So first question, is this the right way of doing it? and secondly how does one create such a control sothat when you place the control on your form, the toolstripbuttons actual display?
Many thanks in advance
Kind regards,
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
Sounds reasonable. Derive a class from ToolStrip, and in the constructor add your buttons to it. You can then just use this interchangably with a normal ToolStrip on your forms.
Regards,
Rob Philpott.
|
|
|
|
|