Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 5th, 2008, 08:38 AM
Registered User
 
Join Date: Nov 2008
Location: , , .
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?




Reply With Quote
  #2 (permalink)  
Old November 5th, 2008, 08:41 AM
samjudson's Avatar
Friend of Wrox
Points: 8,352, Level: 39
Points: 8,352, Level: 39 Points: 8,352, Level: 39 Points: 8,352, Level: 39
Activity: 35%
Activity: 35% Activity: 35% Activity: 35%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,072
Thanks: 1
Thanked 177 Times in 176 Posts
Default

Code:
DateTime.Today.AddDays(-1)
/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #3 (permalink)  
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



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 12:42 PM
how to get the day from a given date pherms Classic ASP Basics 2 April 16th, 2004 05:38 PM



All times are GMT -4. The time now is 09:51 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.