Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 5th, 2008, 09:38 AM
Registered User
 
Join Date: Nov 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default subtracting 1 day from the current date



I need the code for subtract 1 day or 1 year from the current date

Today() - 1?




 
Old November 5th, 2008, 09:41 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Code:
DateTime.Today.AddDays(-1)
/- Sam Judson : Wrox Technical Editor -/
 
Old March 12th, 2009, 01:16 AM
Registered User
 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default subtracting 1 day from the current date

Step-1
<%
Function pd(n, totalDigits)
if totalDigits > len(n) then
pd = String(totalDigits-len(n),"0") & n
else
pd = n
end if
End Function
%>

Step-2

<%response.write Pd(DAY (date()-1),2) & Pd(Month(date()),2) & YEAR(Date())%>(Yesterday)


====================================
Best Regard
Imran Khan
+923343849896








Similar Threads
Thread Thread Starter Forum Replies Last Post
Current Date s15199d Reporting Services 2 April 3rd, 2006 12:38 AM
make date display go back a day crmpicco Javascript How-To 2 March 16th, 2006 01:42 PM
how to get the day from a given date pherms Classic ASP Basics 2 April 16th, 2004 05:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.