time & date: erro

V

Vinnie

I'm using this code to get the time and the current date, but i get
and error:

System.Globalization.CultureInfo culture = new
System.Globalization.CultureInfo();
System.Globalization.CultureInfo("pl-PL");

LabelData.Text = String.Format(culture.DateTimeFormat,"Today is
{0:dd}, {0:MMMM} {0:yyyy}, {0:HH} {0:mm} {0:ss}", DateTime.Now);


The first error is:
- No overload for method 'CultureInfo' takes '0' arguments;

The second one is:
- 'System.Globalization.CultureInfo' is a 'type', which is not valid
in the given context

what i should change?

thanks,
Vinnie
 
M

Mike Placentra II

You need to specify the culture in the constructor:

System.Globalization.CultureInfo culture = new
System.Globalization.CultureInfo("pl-PL");
LabelData.Text = String.Format(culture.DateTimeFormat,"Today is
{0:dd}, {0:MMMM} {0:yyyy}, {0:HH} {0:mm} {0:ss}", DateTime.Now);

-Michael Placentra II
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top