Format Date

  • hi

    I wanted to put a parameter by default DATE of yesterday?

    How do I create the Format

  • Here is a list of the popular date calculations:

    First Date of last month: =Format(DateAdd("m", -1, DateSerial(Year(Now()), Month(Now()), 1)),"dd/MM/yyyy")

    Last date of last month: =Format(DateAdd("d", -1, DateSerial(Year(Now()), Month(Now()), 1)),"dd/MM/yyyy")

    First date of current month: =Format(DateSerial(Year(Now()), Month(Now()), 1),"dd/MM/yyyy")

    Last date of current month: =Format(DateAdd("d",-1,(DateAdd("m", 1, DateSerial(Year(Now()), Month(Now()), 1)))),"dd/MM/yyyy")

    Yesterday's date : =Format(DateAdd("d", -1, now()),"dd/MM/yyyy")

    tomorrow's date : =Format(DateAdd("d", 1, now()),"dd/MM/yyyy")

  • I do the following process

    Parameter Properties --> Default Values --> Specify Values --> add --> fx --> =Format(DateAdd("d", -1, now()),"dd/MM/yyyy") --> ok

    When I Preview gives this error

    an error occurred during local report processing.

    The property 'DefaultValue' of report parameter 'DateDe' doesn't have the expected type

    What is the problem?

  • What happens if you wrap the expression in the CDate function? Like:

    =CDate(Format(DateAdd("d", -1, now()),"dd/MM/yyyy"))

  • Already works. Thank you

  • Glad you got it working! Thanks for letting us know.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply