已答复 Next Day Expression

  • Wednesday, November 14, 2012 1:40 PM
     
     

    How do i write an expression for 10am Next Day


    Lummzy

All Replies

  • Wednesday, November 14, 2012 1:48 PM
     
     

    DATEADD(HOUR, 34, DATESERIAL(YEAR(x) , MONTH(x), DAY(x)))


    Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu

  • Wednesday, November 14, 2012 7:14 PM
     
     Proposed Answer Has Code

    For an SSRS expression to return tomorrow at 10:00 AM:

    =DATEADD("h",10,DATEADD("d",1,Today()))


    Please Mark posts as answers or helpful so that others can more easily find the answers they seek.

  • Thursday, November 15, 2012 9:32 AM
     
     

    Hi Tim, Many thanks for this as this greatly works. How about if i want to show a time as 10.20am ?

    Also i want to exclude Saturday or Sunday from the next day. That is for Friday the next day should be Monday.

    How can i achieve this in a single expression .

    Thanks 


    Lummzy

  • Thursday, November 15, 2012 9:47 AM
     
     

    Hello,

    try this query

    SELECT startDate,EndDate,DATEDIFF(DD,startDate,EndDate) FROM Production.WorkOrder WHERE ((DATEPART(dw, StartDate) + @@DATEFIRST) % 7) NOT IN (0, 1)

    for more detail see this link exclude weekend days from Claender



    blog:My Blog/

    Hope this will help you !!!
    Sanjeewan

  • Thursday, November 15, 2012 12:17 PM
     
     
    I want to do this in the reports not from sql. Any idea ?

    Lummzy

  • Thursday, November 15, 2012 1:47 PM
     
     

    if you are using US date (means the week cycle starts on sunday), then try:

    =today().AddDays(iif(today().DayOfWeek = 5,3,1)).AddMinutes(620)

  • Thursday, November 15, 2012 3:14 PM
     
     Answered

    Solution is to wrap another DATEADD around the existing formula to add 20 minutes. Note that minutes is "n" not "m". "m" is for months.

    =DATEADD("n",20,DATEADD("h",10,DATEADD("d",1,Today())))


    Please Mark posts as answers or helpful so that others can more easily find the answers they seek.