• Format Year With Leading Zero? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Format Year With Leading Zero? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    • This topic has 8 replies, 4 voices, and was last updated 21 years ago.
    Author
    Topic
    #403082

    The following command is retruning 3, I need it to return 03

    Thanks, John

    Me.strYearFrom = Format(Date, “yy”) – 1 ‘ 03

    Viewing 5 reply threads
    Author
    Replies
    • #807771

      I tryed: Me.strYearFrom = Format(DateSerial(2004 – 1, 3 – 1, 1 – 1), “yy”)

      It returned 03, but I’m not sure of the gotchas with this. Those more in the know will have to comment.

      You could also try: Me.strYearFrom = Right(DatePart(“yyyy”, Now()) – 1, 2)

      Anyone?

    • #807772

      I tryed: Me.strYearFrom = Format(DateSerial(2004 – 1, 3 – 1, 1 – 1), “yy”)

      It returned 03, but I’m not sure of the gotchas with this. Those more in the know will have to comment.

      You could also try: Me.strYearFrom = Right(DatePart(“yyyy”, Now()) – 1, 2)

      Anyone?

    • #807821

      Try

      Me.strYearFrom = Format(DateAdd(“yyyy”, -1, Date), “yy”)

    • #807822

      Try

      Me.strYearFrom = Format(DateAdd(“yyyy”, -1, Date), “yy”)

    • #807823

      How about using the Year() function something like:

      Me.strYearFrom = Right(Year(Date)-1,2)

    • #807824

      How about using the Year() function something like:

      Me.strYearFrom = Right(Year(Date)-1,2)

    Viewing 5 reply threads
    Reply To: Format Year With Leading Zero? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: