Date Code

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

    #1

    Date Code

    Dim CurrentDate As Date = Format(Today, "MM/dd/yy")

    Dim FutureDate As Date = CurrentDate.Add Years(1)

    What am I doing wrong?

    I want the CurrentDate to read 07/09/03 and FurtureDate to read 07/09/04,
    but in the browser it reads 7/09/2003 and 7/09/2004 respectfully.

    Do anyone see something wrong? Please help!


  • Natty Gur

    #2
    Re: Date Code

    Hi,

    When you enter a value into DataTime object the value will be keep in
    the default format. If you want to write it down in specific format,
    reformat it :

    System.DateTime CurrentDate = System.DateTime .Now ;
    System.DateTime FutureDate = CurrentDate.Add Years(1);
    string ww = FutureDate.ToSh ortDateString ();

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

    Comment

    • Leon Shaw

      #3
      Re: Date Code

      Found the Solution, Thanks So Much!
      "Natty Gur" <natty@dao2com. com> wrote in message
      news:OIFGoupRDH A.1324@TK2MSFTN GP11.phx.gbl...[color=blue]
      > Hi,
      >
      > When you enter a value into DataTime object the value will be keep in
      > the default format. If you want to write it down in specific format,
      > reformat it :
      >
      > System.DateTime CurrentDate = System.DateTime .Now ;
      > System.DateTime FutureDate = CurrentDate.Add Years(1);
      > string ww = FutureDate.ToSh ortDateString ();
      >
      > Natty Gur, CTO
      > Dao2Com Ltd.
      > 28th Baruch Hirsch st. Bnei-Brak
      > Israel , 51114
      >
      > Phone Numbers:
      > Office: +972-(0)3-5786668
      > Fax: +972-(0)3-5703475
      > Mobile: +972-(0)58-888377
      >
      > Know the overall picture
      >
      >
      > *** Sent via Developersdex http://www.developersdex.com ***
      > Don't just participate in USENET...get rewarded for it![/color]


      Comment

      Working...