Date Formatters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PeteZ

    #1

    Date Formatters

    There seems to be loads of alternative date formats but not one that suits
    what I need.

    eg How could I format the current date like:

    DD-MON-YY hh:mm:ss ( sample: 02-NOV-03 7:35:55 )


    - Simon


  • Hayato Iriumi

    #2
    Re: Date Formatters

    You can try this.

    string strDateTime = DateTime.Now.To String("dd-MMM-yy hh:mm:ss");
    Console.WriteLi ne(strDateTime) ;
    Console.Read();

    By hitting F1 when you get ToString() method for DateTime.Now, you will see
    the whole list of formatting in MSDN library.

    "PeteZ" <peteZ@aol.co m> wrote in message
    news:uKIGTNAfDH A.3204@TK2MSFTN GP11.phx.gbl...[color=blue]
    > There seems to be loads of alternative date formats but not one that suits
    > what I need.
    >
    > eg How could I format the current date like:
    >
    > DD-MON-YY hh:mm:ss ( sample: 02-NOV-03 7:35:55 )
    >
    >
    > - Simon
    >
    >[/color]


    Comment

    • dominic paquette

      #3
      Date Formatters

      Hi

      something like this:

      string strDate
      DateTime dt = DateTime.Now;
      strDate = dt.ToString("dd-MM-yy H:mm:ss");

      hope this helps
      dominic

      [color=blue]
      >-----Original Message-----
      >There seems to be loads of alternative date formats but[/color]
      not one that suits[color=blue]
      >what I need.
      >
      >eg How could I format the current date like:
      >
      >DD-MON-YY hh:mm:ss ( sample: 02-NOV-03 7:35:55 )
      >
      >
      >- Simon
      >
      >
      >.
      >[/color]

      Comment

      • PeteZ

        #4
        thanks


        "PeteZ" <peteZ@aol.co m> wrote in message
        news:uKIGTNAfDH A.3204@TK2MSFTN GP11.phx.gbl...[color=blue]
        > There seems to be loads of alternative date formats but not one that suits
        > what I need.
        >
        > eg How could I format the current date like:
        >
        > DD-MON-YY hh:mm:ss ( sample: 02-NOV-03 7:35:55 )
        >
        >
        > - Simon
        >
        >[/color]


        Comment

        Working...