Could you tell me what code to be write for Year account. -------------------------------------------------------------------------------- Here the Function:
Private Function CreateDateString(ByVal pastDate As DateTime, ByVal days As TimeSpan) As String
Dim day As String = DateTime.UtcNow.Subtract(days).Day.ToString Dim month As String = DateTime.UtcNow.Subtract(days).Month.ToString
If month.Length = 1 Then month = String.Format("{0}{1}", "0", month) End If
If day.Length = 1 Then day = String.Format("{0}{1}", "0", day) End If
Return String.Format("{0}{1}{2}{3}", DateTime.UtcNow.Year, month, day, "000000.0Z")
End Function -------------------------------------------------------------------------------- To Fix: Code change to fix the bug in CreateDateString() in account for the change in the year.
What code to be done above problem: for Year account. -------------------------------------------------------------------------------- Issue: Batch process cannot pick up users to be processed during the time period of 1/1 to 1/22 every year. The result of this is that former users whose a-terminationDate attribute is between 12/11/xx and 1/1/xx cannot be processed by the batch. -------------------------------------------------------------------------------- Problem Description: There is a bug in the function that performs the comparison of the user's a-terminationDate with the search range. The function is not able to account for the change in the year (ex. 2008 to 2009) that is why the batch cannot pick up users during a specific time period. To illustrate, suppose today's date is 1/1/09. The search range for a-terminationDate should be 12/11/08 to 12/18/08 (Subtract 21 and 14 days). Because of the bug, the function returns 12/11/09 to 12/18/09. No users will be retrieved using this search range because these are future dates. This will be self-corrected on 1/22/09 because the search range will become past dates again (1/1/08 to 1/7/08). However there will be skipped users whose a-terminationDate is between 12/11/08 and 1/1/08. -------------------------------------------------------------------------------- To Fix: Code change to fix the bug in CreateDateString() in account for the change in the year. -------------------------------------------------------------------------------- Thanks Advance!
|
| Author: vipul 24 Nov 2008 | Member Level: Diamond | Rating:  Points: 5 |
Hi, you do this way DateTime dt = new DateTime(); dt = Convert.ToDateTime("01/01/09"); // pass you date or take currnet date
// add -21 days in your date so you get value 12/11/08 Response.Write(dt.AddDays(-21).ToShortDateString() + "<br/>"); // add -14 days in your date so you get value 12/18/08 Response.Write(dt.AddDays(-14).ToShortDateString());
i think you want this.
vipul
Please Rate This Answer If They Helpful
Thanks & Regards Patel Vipul
|
| Author: tvsuresh 24 Nov 2008 | Member Level: Bronze | Rating:  Points: 0 |
I'm not clear your solution.
|
| Author: vipul 24 Nov 2008 | Member Level: Diamond | Rating:  Points: 0 |
Hi, you want this way or not
vipul
Please Rate This Answer If They Helpful
Thanks & Regards Patel Vipul
|
| Author: tvsuresh 24 Nov 2008 | Member Level: Bronze | Rating:  Points: 6 |
Thanks for your response.
Here I'm Just asking for Code to fix the bug in CreateDateString()account for the change in the year.
As per my query, The function is not able to account for the change in the year (ex. 2008 to 2009) that is why the batch cannot pick up users during a specific time period. To illustrate, suppose today's date is 1/1/09. The search range for a-terminationDate should be 12/11/08 to 12/18/08 (Subtract 21 and 14 days). Because of the bug, the function returns 12/11/09 to 12/18/09. No users will be retrieved using this search range because these are future dates.
How do i create account for the year in the below function. ---------------------------------------------------------------------- Private Function CreateDateString(ByVal pastDate As DateTime, ByVal days As TimeSpan) As String
Dim day As String = DateTime.UtcNow.Subtract(days).Day.ToString Dim month As String = DateTime.UtcNow.Subtract(days).Month.ToString
If month.Length = 1 Then month = String.Format("{0}{1}", "0", month) End If
If day.Length = 1 Then day = String.Format("{0}{1}", "0", day) End If
Return String.Format("{0}{1}{2}{3}", DateTime.UtcNow.Year, month, day, "000000.0Z")
End Function ----------------------------------------------------------------------
|