Solved

Building specific dates and times

Posted on 2011-09-06
6
391 Views
Last Modified: 2012-05-12
I am trying to build a date time for the first of last month at 6am through the first day of this month at 6am. This is the formula I've built, but I'm getting an error on the first one saying that where I have 01 & Time(06,00,00) there should "be a number here".

This formula works for getting 6am 8 days ago and 6am 1 day ago.
{VW_BATCH_DETAILS_ALL.DATETIME_BATCH}
IN[DateTime(CurrentDate-8 & Time(06,00,00)) to DateTime(CurrentDate-1 & Time(06,00,00))]

However, this formula (adapted from that one) does not work.
{VW_BATCH_DETAILS_ALL.DATETIME_BATCH}
IN  [DateTime(DATEPART("YYYY",CurrentDate), DATEPART("m",CurrentDate)-1, 01 & Time(06,00,00))
TO   DateTime(DATEPART("YYYY",CurrentDate), DATEPART("m",CurrentDate), DATEPART("dd",CurrentDate)-1 & Time(06,00,00))]
0
Comment
Question by:Hers2keep
  • 3
  • 2
6 Comments
 

Author Comment

by:Hers2keep
ID: 36489818
I modified that formula on the "TO" date as shown:
{VW_BATCH_DETAILS_ALL.DATETIME_BATCH}
IN  [DateTime(DATEPART("YYYY",CurrentDate), DATEPART("m",CurrentDate)-1, 01 & Time(06,00,00))
TO   DateTime(CurrentDate & Time(06,00,00))]

However, I still get the error on the "FROM" datetime. This report will run automatically on the first of the month sometime after 6am.
0
 
LVL 5

Expert Comment

by:wkrasner
ID: 36489925
{tblWorkOrder.dtCompleted} in  DateTime(DATEPART("YYYY",CurrentDate), DATEPART("m",CurrentDate)-1, 1,6,0,0)
TO   DateTime(CurrentDate & Time(06,00,00))
0
 
LVL 5

Accepted Solution

by:
wkrasner earned 500 total points
ID: 36489927
I meant

{VW_BATCH_DETAILS_ALL.DATETIME_BATCH} in  DateTime(DATEPART("YYYY",CurrentDate), DATEPART("m",CurrentDate)-1, 1,6,0,0)
TO   DateTime(CurrentDate & Time(06,00,00))
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Closing Comment

by:Hers2keep
ID: 36489936
Stupendous! I was trying to make it more difficult than it needed to be.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36490477
Your errror is because DateTime uses
DateTime(DatePart,TimePart)
or
DateTime(yyyy,mm,dd,hh,mm,ss)

There is a problem with the chosen formula.  It won't work for Jaunary since you aren't decreasing the year and month 0 doesn't exist.   Also the end time is today at 6am not the first of the month at 6am.

Actually you need to use

{VW_BATCH_DETAILS_ALL.DATETIME_BATCH} in  DateTime(Minimum(LastFullMonth),Time(6,0,0)) to  DateTime(Date(Year(CurrentDate),Month(CurrentDate),1),Time(06,00,00))

mlmcc
0
 

Author Comment

by:Hers2keep
ID: 36490663
Duly noted - I modified the formula. Thanks for the heads up!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question