time & date: erro

Discussion in 'ASP .Net' started by Vinnie, Oct 3, 2007.

  1. Vinnie

    Vinnie Guest

    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
     
    Vinnie, Oct 3, 2007
    #1
    1. Advertising

  2. 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


    On Oct 3, 3:51 pm, Vinnie <> wrote:
    > 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
     
    Mike Placentra II, Oct 3, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TJS
    Replies:
    1
    Views:
    2,818
    Natty Gur
    Dec 20, 2003
  2. Patrick Olurotimi Ige
    Replies:
    2
    Views:
    4,299
    Patrick Olurotimi Ige
    Feb 8, 2005
  3. Chris Berg
    Replies:
    0
    Views:
    795
    Chris Berg
    Oct 27, 2003
  4. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,278
    Michael Borgwardt
    May 30, 2004
  5. Keith Cochrane
    Replies:
    2
    Views:
    626
    Keith Cochrane
    Aug 6, 2006
Loading...

Share This Page