Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Format Date Expand / Collapse
Author
Message
Posted Thursday, March 28, 2013 5:23 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, July 31, 2014 4:32 AM
Points: 40, Visits: 154
hi
I wanted to put a parameter by default DATE of yesterday?
How do I create the Format
Post #1436398
Posted Thursday, March 28, 2013 6:06 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, January 17, 2014 11:31 AM
Points: 26, Visits: 180
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")
Post #1436420
Posted Thursday, March 28, 2013 6:30 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, July 31, 2014 4:32 AM
Points: 40, Visits: 154
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?
Post #1436435
Posted Thursday, March 28, 2013 8:11 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, January 17, 2014 11:31 AM
Points: 26, Visits: 180
What happens if you wrap the expression in the CDate function? Like:

=CDate(Format(DateAdd("d", -1, now()),"dd/MM/yyyy"))
Post #1436487
Posted Thursday, March 28, 2013 8:53 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, July 31, 2014 4:32 AM
Points: 40, Visits: 154
Already works. Thank you
Post #1436524
Posted Thursday, March 28, 2013 9:01 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, January 17, 2014 11:31 AM
Points: 26, Visits: 180
Glad you got it working! Thanks for letting us know.
Post #1436541
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse