Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Adding Expiration Date On My Program


Hi,
can someone tell me a way to put an expiration date on my program, kind of like being an evaluation version or a trialware. Pls tell me as many ways as possible, so i can compare.


many thanx~!~!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Program Expiration Date
I'm creating a small program based on Microsoft Excel and also incorporating
VBA. For demo purposes of this program I wanted to code it for expiration
after a determined period of time. In other words whether the program is
installed on disc or computer after a predetermined date it is unusable. I
can't seem to come up with a VBA code. Anyone out there have any suggestions?

Thanks in advance,

Gary N

Adding Software Expiration Mechanism...
Dear All,

Just wanna know, is there any suggestion for adding software expiration mechanism into our program. Something like evaluation copy, shareware.

any suggestion?

Date Expiration Help
I am creating a Quotation spreadsheet that I need to have an alert message when "Quotation Date" is older than 30 days of "Today's Date".

Example:

Quotation Date: 1/1/2008
Today's Date: 2/29/2009

Alert:
QUOTATION EXPIRED! Call Vendors to re-quote.

I kind of know that the formula is =IF....... but don't know how to write the rest.

Help me please........

Expiration Date
is there a code where you could make an expiration date for a software made from VB? i don't know if i made out my point there. but i'm asking about the expiration date code if there is.


craig

-------------------------------
Imagination is better than knowledge.
start a nursing agency | background check

Creating Expiration Date
hey,
 I am creating a program for a company, and I want to create a expiration date incase they do not want to buy it, so that it will not work after a certain date. (like a shareware)
 any comments would be great..

thanks
mark bowser

Need To Abort The Application Upon The Expiration Date
Hi All,

I am very new to VB 6.0. My area of work is database development. But I have given this assignement which needs the VB coding. We have an application which need to be expired on January 1, 2008.

I need to check the date on the SQL server after the connection to the database from application. If the date is Jan. 1, 2008 the application should abort (unload the form)

So far I came to the point where after the connection to DB if checks for the date on SQL server and then if the date is passed it gives the error.

Can anyone tell me if the followign code is correct? Or can I wrote something more efficient? How should I close the form to come out of applcaition?

Here is my code:

'DB connection
With gCnDB
         .Provider = "SQLOLEDB"
         .CursorLocation = gCursorLocation
         .Properties.Refresh
         .ConnectionString = sConnection
         .Properties("Application Name") = "TestX 2000"
                        
         .Open
          numdays = Checkdate() 'checkdate() fun. to check the number of days remaining for expiration
          MsgBox (numdays)
          If numdays <= 0 Then
          MsgBox ("Lisence expired. Please contact your
vendor")
                    
          End If
          End With
          
Public Function Checkdate() As Integer

Dim cmdWork As ADODB.Command
Dim rsWork As ADODB.Recordset
Dim numdays As Integer

Set cmdWork = New ADODB.Command
With cmdWork
    Set .ActiveConnection = gCnFXDB
       .CommandText = "select datediff ( dd, getdate (), 'Jan 1 2008')
as numdays"
        
    Set rsWork = New ADODB.Recordset
    With rsWork
    .Open Source:=cmdWork
        If Not .EOF Then
        numdays = .Fields("numdays").Value
        End If
    rsWork.Close
    
    End With
        
End With
   Checkdate = numdays
   Exit Function
End Function

        
Thanks in advance

-testPA


Creating Registry For Date Expiration On MS Access
Hi,

Can anyone help me where can I find so informative site about my problem..I want to create a date expiration on MS access and many say creating registry is the best way to protect my prelauch demo tool in MS access.

Hope somebody can help me with this..

Turning MS Access File Into .exe Using VB6 With Expiration Date
Hi,

Can someone kindlyhelp me how to make the MS Access database into .exe file using VB6 and putting a date expiration so that I can dictate how long the MS Access database can be used. Let say 1 month only.

I remember that using OLE in VB6 to link MS access database I can compile it and turn into .exe file but I forgot it already.

Many thanks.

Getting Account Expiration Date From Active Directory For A Given User
I'm need to create a function that gets the account expiration date from Active Directory for a given user. I've been a VB developer for years, but I'm not that familiar with accssing AD information and I'm not seeing a lot of documentation out there. Any help or code samples would be greatly appreciated.

Program Expiration Script Question
Hi,
Currently I'm trying to make one of my programs have an expiration date of 30 days. Right now I have it such that if the date is greater than 30 days it will disable a button on one of my forms preventing a user from using the program. I know that if the program goes past 30 days, the program cannot be re-enabled without entering a dummy passcode such as '12345'. But if the user wants to rollback their clock on day 29, the program will work. How can I fix my program such that the user can't simply roll back the date on the pc? here is what I have for coding.

'This section checks the current date and compares it to the date on the computer.
'If the date is beyond the date specified in the conditions, the program will shut down.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''
Dim str As String
Dim str1 As String
Dim str2 As String
Dim initialDate As Date
Dim expDate As Date
Dim expDate2 As Date
Dim usedDate As Date

str = GetSetting("CleanSEQ", "Expiration", "Start Date") 'First Get the Value from the Registry

If Len(Trim(str)) < 1 Then 'If the Registry Value is not set then Set the Value
SaveSetting "CleanSEQ", "Expiration", "Start Date", Date
expDate = DateAdd("d", 30, Date) 'Add 30 days to the Current Date
SaveSetting "CleanSEQ", "Expiration", "Expiration Date", expDate 'Here I have Given 30 days for expiration of the Software You can Give 'n' no of days as you like
Else
str1 = GetSetting("CleanSEQ", "Expiration", "Used Date") 'If this Registry Value is not Set then
If Len(Trim(str1)) < 1 Then
str = GetSetting("CleanSEQ", "Expiration", "Start Date") 'Get the Previously set Initial Value from the Registry
initialDate = CDate(str)
str2 = GetSetting("CleanSEQ", "Expiration", "Expiration Date") 'Get the Expiry Value from the Registry
expDate = CDate(str2)
If Date > expDate Or Date < initialDate Then 'Compare Registry Values with the Date, if they are bound with in the Initial Value of the Software and Expiry Value of the SOftware then only the Program will run
SaveSetting "CleanSEQ", "Expiration", "Used Date", "True" 'Now set the Used Date value to True
MsgBox "This demo program has expired. Thank you! (101)", vbExclamation, "Software Expired(101)"
Unload Me
Form_CleanSEQ_PS2_Demo2.btnOK.Enabled = False
End If
Else
MsgBox "This demo program has expired. Thank you! (102)", vbExclamation, "Software Expired (102)"
Unload Me
Form_CleanSEQ_PS2_Demo2.btnOK.Enabled = False
End If

End If

If DateDiff("y", Date, expDate) < 0 Then 'If the date on the computer is earlier than the original install date, passcode must be entered

Dim Key As String

Key = InputBox("You have 0 Days Left to use the program. If you have an unlock code, please enter it")
If (Key = "12345") Then
DeleteSetting "CleanSEQ", "Expiration"
SaveSetting "CleanSEQ", "Expiration", "Start Date", Date
expDate = DateAdd("yyyy", 6000, Date) 'Add 30 Years to the Current Date
SaveSetting "CleanSEQ", "Expiration", "Expiration Date", expDate
MsgBox "Thank you for purchasing CleanSEQ!"
Form_CleanSEQ_PS2_Demo2.btnOK.Enabled = True
End If

Else

If DateDiff("y", Date, expDate) > 30 Then 'If the date on the computer is more than 30 days from original install, passcode must be entered

Else

Key = InputBox("You have " & DateDiff("y", Date, expDate) & " days left to use the program. Once the key has been entered into the text box below, the software will be unlocked. Thank you!")
If (Key = "12345") Then
DeleteSetting "CleanSEQ", "Expiration"
SaveSetting "CleanSEQ", "Expiration", "Start Date", Date
expDate = DateAdd("yyyy", 6000, Date) 'Add 30 Years to the Current Date
SaveSetting "CleanSEQ", "Expiration", "Expiration Date", expDate
MsgBox "Thank you for purchasing!"
Form_CleanSEQ_PS2_Demo2.btnOK.Enabled = True
End If

End If
End If

Expiration Dates - Demo Program
Does anyone know how to allow a program to run for only a specified time (i.e. 30 days) after installation without relying on the system date? I am in the middle of distributing a demo program but need find the best way to make it work for only 30 days after installation. Thanks.

Checking Dates For Expiration In Program...
Hi, I have set up some simple ways to make my program expire. I don't need anything fancy, so as long as it works, I'm happy.

OK, I created 3 separate pieces of code to check the dates.

1. Using DateSerial
2. Using a INI file
3. Using the registry file

My problem is that some users use the European date format (DD/MM/YYYY) and I'm using the USA format (MM/DD/YYYY). Some users are complaining about why the program is expiring before they even ran it. I told them to change their date formats for now.

Not sure if you want all the code for this, but for the first one, it's basically like:
Code:
If Now > DateSerial(2005, 4, 1) Then
'expire message....

I read somewhere here that it's better to use another method and not DateSerial but forgot what it's called. Well, I tried that other method and it gave me some kind of error. So I used DateSerial now and like how it works. Only problem is how do I modify the code to check for those who use the European date format?

For the INI and registry file, I just created a line/entry in the file/registry with the expire date. How can I modify the code to incorporate the European date format for them also? I'm entering the expire dates manually (no 30 days scheme or anything like that - it's a set date).

Below are code snippets for the INI and registry:

Code for INI File:
Code:
'set expire date here
Result = WritePrivateProfileString("Expire Date", "Date", CStr(Format(Now, "4/1/2005")), INIFileName)

A piece of the Registry code:
Code:
'I hope I'm getting something here, forgot exactly whey I did that, but it
looks like I changed it to MM/DD/YYYY to reflect the date here in the USA
TodayDate = Format(Now, "mm/dd/yyyy")
If TodayDate > MyValue Then

I have another question in regards to the INI and registry file. I want to learn how to encrypt them. I read the tutorials about encryption but don't know how to actually implement it so that it will encrypt the INI and registry file. Did a search and found someone who wrote the code for it, but was lost after trying to use it in my program.

Thanks.

Working Out A Date By Adding Days To Another Date
hi,
I have a date and number of days.
I'm trying to work out the date that comes out of adding the days to the original date (bringing into account months and end of year etc.)
would simply adding the days to the date do the trick (Date = MyDate + Days) ?

thanx

How To Get The Right Date Format After Adding A Date
Hi ,

The below is the Code in the Timer. The Purpose is to when the Time Reaches the process should done. The process is

Reading a Encrypted text from the file named ImpDate.TXT, the Text is the date and its Format Is (“MM/DD/YYYY HH:MM:SS AM/PM”).

After reading it I am storing it in a string. Then I need to add one day with Date which I get and Decrypted. Then again I will encrypt it and over write the ImpDate.TXT File.

Private Sub Timer1_Timer()

MyTime = Format(TimeValue("12:05:50 PM"), "HH:MM:SS AM/PM")
CurTime = Format(Time, "HH:MM:SS AM/PM")

If MyTime = CurTime Then

‘’ Reading the Encrypted Text from the File
    Open "C:chsImpDate.TXT" For Input As #1
    While Not EOF(1)
    Line Input #1, st
    Wend
    Close #1
   
 Secret$ = st
  Password$ = "vehiclesystem"
‘’Decrypting the Encrypted Text and add one day with it and again I have Encrypt and Store. For testing whether the one day is added or not, I write it in a file DecDate and checked.

  Call Decrypt(Secret$, Password$)
   sts = Format(st, "MM/DD/YYYY")
       Dim nFile As Integer
    nFile = FreeFile
    Open "C:chsDecDate.TXT" For Append Shared As #nFile

    Print #nFile, sts
    Close #nFile
End If
End Sub

The problem is I am getting the wrong date is coming as below

01/27/1900 12:00:00 AM

tried in various ways but not coming the correctly.

Thank you very much,
Chock.

Expiration
i have a very simple question about dates: i want my program to expire after a certain date. i tried using this code:

Code:
If Date >= "4/25/00" Then
'some code

this doesn't work. could anyone give me any pointers on how to make a program expire? thanks a lot.

michael

Adding Code To My Program Through The Completed Program.
Hello,

I have a program that calculates some numbers.

Here is how it works.

1 the user inputs 2 numbers. A High and a Low into two text boxes.
Then the user presses Calculate and it does a series of mathamatics.
Once that is complete it out puts 5 different numbers to a table sort of deal.

NOW what I want to do is let the user enter a 6th number to calculate and output onto that table.

So lets say this is my code for the calculation.


VB Code:
Private Sub cmdCalculate_Click()Text1.Text = (txtHigh.Text - txtLow.Text) * 0.738 + (txtLow.Text)Text2.Text = (txtHigh.Text - txtLow.Text) * 0.093 + (txtLow.Text)Text3.Text = (txtHigh.Text - txtLow.Text) * 0.865 + (txtLow.Text)Text4.Text = (txtHigh.Text - txtLow.Text) * 0.953 + (txtLow.Text)Text5.Text = (txtHigh.Text - txtLow.Text) * 0.876 + (txtLow.Text)End Sub


Now I have a textbox on my form to enter a new number to calculate. So lets say the user wants that number to be "0.459" He would enter 0.459 into the textbox "txtNewnum" and click the cmdAdd button.

Then the program would have to add a new line of code to the 5 lines mentioned above and it would look like this.

VB Code:
Text6.Text = (txtHigh.Text - txtLow.Text) * [b]0.459[/b] + (txtLow.Text)


Does anyone know how I could pull this off?

Thank you and have a great day!
Stilekid007

How To Make A Program That Will Check If The Latest Program Is Update To Date?
How to make a program that will check if the latest program is update to date?

lets say the program got revison 1.0.0, revision 1.0.1 ...
when a user start a program, it will download the latest program the the latest program will be started.

thanks.

Password Expiration
please, I need an urgent help in my vb6.0 coding. I designed a form that has a textbox for entering of password. this form has a command button. I want three different passwords to access this project; let us assume that when each person types the correct password in the textbox and click on the command button then a message is displayed using the message box (e.g "you are welcome") the passwords might be "john" "paul" and "peter" for the first, second, and third person respectively; these are the correct passwords. On the second attempt when the user types the same correct password and clicks on the command button then an error message will be displayed telling the user that the password has already expired. My problem in this program is how to write the vb-code that will only allow the three different users to login only once after which their passwords bocome invalid or expire. please, I need a clear explaination on this. I love you all. from Ken. <email address removed by moderator, to protect from spam bots>.


please, I still need your help in another problem. I want to design a form in vb6.0; this form will have labels on it. I want to use the labels to capture the time and the date of an event (e.g a click event). My problem is on how to save the time and date that is captured by the labels. This means that I want to save this form so that after closing the form and probably shutt the computer down then the exact time and date that was captured by the labels will be seen any other time I switch on the computer and then open the form. thanks for your kindness in helping me. please, don't forget that this is an urgent issue.

Problem Regarding .expiration Of Exe
hi,
i have problem regarding .expiration of exe. the problem is, when user install the application on the system, from then user can access the appliction for two days. whether user works or not between these time . the application should not work after the expiration days. if user manipulate the system date. then it should not effect the expiration period..

if any one help me regarding . i would be obliged

Exe Does Not Work After The Expiration
hi all
i have a problem. i make an exe, which runs only two days.after 2 days no one can use this exe by manipulating sytem date.
i thought, a solution the value count by hour wise. when value equals to 24 hours. the application could not work.

i would be highly appreaciate, some help regarding this

Password Expiration
please, I need an urgent help in my vb6.0 coding. I designed a form that has a textbox for entering of password. this form has a command button. I want three different passwords to access this project; let us assume that when each person types the correct password in the textbox and click on the command button then a message is displayed using the message box (e.g "you are welcome") the passwords might be "john" "paul" and "peter" for the first, second, and third person respectively; these are the correct passwords. On the second attempt when the user types the same correct password and clicks on the command button then an error message will be displayed telling the user that the password has already expired. My problem in this program is how to write the vb-code that will only allow the three different users to login only once after which their passwords bocome invalid or expire. please, I need a clear explaination on this. I love you all. from Ken. Email me on: email@removed . please, I still need your help in another problem. I want to design a form in vb6.0; this form will have labels on it. I want to use the labels to capture the time and the date of an event (e.g a click event). My problem is on how to save the time and date that is captured by the labels. This means that I want to save this form so that after closing the form and probably shutt the computer down then the exact time and date that was captured by the labels will be seen any other time I switch on the computer and then open the form. thanks for your kindness in helping me. please, don't forget that this is an urgent issue.

AD Password Expiration
I got this script from John Savill at
http://www.windowsitpro.com/Article/ArticleID/46819/46819.html

I edited it for my domain ou structure and it Wscript.echo's the first echo
with correct information for that user, but on line 56 [ Set
objUserConnection = GetObject("LDAP://" &
objRecordSet.Fields("distinguishedName").Value) ], it errors with (null):
0x80005000.   

Any idea's how to prevent this error without using On Error Resume Next?

There are a lot of long lines that would cause line wrapping.  It's probably
easier for you to visit the link and look at his example.
The only thing I changed was the strRootDomain= string line.

Or if anyone has another script to check when AD users passwords are a certain number of days from expiring...
I prefer a script to third party tools as I'm on a gov campus and have control limited to my OU and not the domain a few levels up.  

Thanks for any help or suggestions!
-Steve



Trialware Expiration
anyone have a good way of preventing software from runnig either after a specific amount of days, or specific number of times it has been run? i gues i could bury a registry value somewhere deep to monitor program runs, but someone always figures that one out. and how could i use the date if they can re-set the system date? any ideas would be appreciated! ps, i have access to external webservers... maybe write a value there??

Password And Time Expiration
Hi there
I have trying to implement password protection for my app,
and I have everthing about my password screen in place
and working just fine. The password gets it info from
a database, and that works fine. The problem is, I will
like to set it up so that every use's password will
expire after a certain time, and I cannot think of a non-
kludgey way of doing this.
For instance, I am thinking of writing the ID, password and date originaly signed-in, to an encrypted file, but that does not seem to hot an idea. Or, I am also thinking writing just the date to a file and checking the file once in a while, but that also do not sound right.
Any general suggestion?
Thanks

Making A Time Expiration
does anyone know how to make a Time Expiration for a program or does anybody have an exemple.

Password Expiration Notification
Hi, folks.
I'm using ADSI / LDAP to authenticate the users of my application and I need to find a way to warn the users when their passwords are about to expire (the same way Windows does when you log in).
Does nayone knows how to get the reamining days before password expiration or how to know if the password expiration date is within the current warning settings (default is 14 days).

Thanks for any input!!


-------------------------------------------------
Sergio Pereira
Consultant
Neumark Technology Group, Inc.

Expiration Dates For Trialware
Anyone know how to add an expiration date to trialware?

I want to create a trialware program with a 90 day limit.

Thanks

Pull Expiration Dates From AD
This works for one user...how do i change it to pull all users from this OU along with expiration dates?

On Error Resume Next
    
    Set objUser = GetObject _
        ("LDAP://cn=username,OU=A-E,OU=VendorsContractors,DC=resource,DC=domain,DC=domain,DC=com")
    
    dtmAccountExpiration = objUser.AccountExpirationDate
    
    If Err.Number = -2147467259 Or dtmAccountExpiration = "1/1/1970" Then
        WScript.Echo "No account expiration date specified"
    'Else
      '  WScript.Echo "Account expiration date: " & objUser.AccountExpirationDate
    End If
    
    getExpireDate = objUser.AccountExpirationDate
    
    

Windows Password Expiration
Does anyone know how to get the number of days until a Windows password expires??

Adding 1 Day To A Date
I am putting the date in like this:
lblDate.Caption = Format(Now, "mmmm d yyyy")
This function ouputs a caption like this:
November 25 2004

I want to be able to add 1 day to the date (or 2 or 3 depending on how many times Command1 is pressed:
(This is semi-pseudo code)

Private Sub Command1_Click()
lblDate.Caption = lblDate.Caption + 1 Day
End Sub

So if Command1 was pressed once:
November 25 2004 becomes November 26 2004

Adding To A Date
I need a code that will show me how to take a Date and add however many days I want to that Date and get a new date as a result

if you get the Idea and know how, show me please.

Adding To A Date
Hello,

Im using the DateAdd() to be able to add 4 years to a certain date from my database.

Ex.

DateAdd('yyyy',4,'4/23/03') = 4/23/07

It's correct but the requirement for me is to subtract 1 day so supposedly, the result should be:

4/22/04

I think DateDiff() will not apply. Help pls.

Adding To A Date?
I'm trying to create a timescale, and need to add 5 minutes to a date every 10 seconds, i have a timer setup on the right interval, but i can't figure out how to add 10 minutes to a DATE variable.

Doing MyTime = MyTime + 10 just adds 10 days, i tried using 0.1 and it went wacko and displayed a seemingly random time. Any help?

Adding To A Date
lets say i have a date in my program
5/26/1983
how would i add a year to it to make it
5/26/1984
these are american format dates but i am guessing the method will be the same.

Adding To A Date
Hello,

Im using the DateAdd() to be able to add 4 years to a certain date from my database.

Ex.

DateAdd('yyyy',4,'4/23/03') = 4/23/07

It's correct but the requirement for me is to subtract 1 day so supposedly, the result should be:

4/22/04

I think DateDiff() will not apply. Help pls.

Adding Into Date In VB
Hi there,

I am having this very strange problem in vb. i am working in excel and trying to find a particular cell based on a variable. I am storing value in that  variable from today's date using the NOW() function. My problem is that when I use the day(now) on its own it works fine, where if i use day(now)-2 it stop working and gives me a error message saying "With block variable not set"

I am using the following code:

Dim mydate As String
Dim exp1 As String
Dim exp2 As Integer
Dim exp3 As Integer
Dim date1 As Date
Sheets("Sheet1").Select
Range("B3").Select
exp1 = Left(Range("B3"), 3)
exp2 = Day(Now) - 2
mydate = exp1 & " " & exp2
Sheets("Sheet1").Select
    Range("A1").Select
    Cells.Find(mydate, After:=ActiveCell, LookIn:=xlFormulas).Activate


********************

In the above if instead of
exp2 = Day(Now) - 2
I use
exp2 = Day(Now)

it works fine, but I actually want to find a cell with today's date -2.

I would appreciate any help.

Thanks


Adding To A Date
How do I add to a date? I thought the following code would work but it
doesn't like it. I'm trying to add 6 months (182 days) onto a date.

Option Explicit

Private Sub Form_Load()
Dim Answer As Integer
Dim GivenDate As Date
GivenDate = "2/1/2004"
Answer = GivenDate + 182
Label1.Caption = Answer
End Sub

Adding A Date To A Filename
Hey Folks

I am currently writing a program that processes a report in excel.
I have been having problems writing code in VB that will allow me to insert the date to the end of the filename. The spreadsheet is called EQ Report. So if the program were run today I would want the filename to be EQ Report (07-Nov-05).

I know how to name the filename, but I am not sure how to format the date so it is not in the 07/11/2005. As you will know backslashes can't be in filenames due to indicating a folder.

I've tried looking at date functions etc and have not really got anywhere with it.

If this is not possible then I would alternatively like to know how to add the month only onto the end of the filename.

Any guidance and tips would be great.

Adding Days To A Date?
I have a date in a field that is adate field and i wish to add a certain number
of days to it based on a day number in another field.
the first date is stored in D14 and the number of days to be added is in E14 and the output date should be in F14
This SHOULD work. "=D13+E13" because in the help file they do the exact same thing! but it doesnt work, why!

Adding Date To File Name
Hi, I have written a VBA program that runs on Excel and puts data on the excel sheet. This runs everyday. I want to be adding the dates to the files, this date is gotten from the excel sheet that uploads into the report excel file. Below is the Code I wrote which doesnt work, please could you help me


Code:
Sheets("Matrix sheet").Select
Today = Cells(1, 1) 'The location of the date on the raw sheet
Today = Format(Today, "dd-mm-yyyy")
Windows("cells.xls").Close savechanges:=True, Filename:="c:Daily_AlertsDaily Alerts_ " & Today & " "

Adding Days To A Date
I already know of the datediff() function, which has helped me in the program thus far. I'm wandering how (to easily) to add basically two weeks to a date.

My program is set up basically so you cant really do anything until you enter the starting date of two weeks. Its for calculating how many hours you've worked in the two week pay period. I'm trying to auto fill the boxes with the date at least so all they have to do is enter the time.

I want to figure this part out because if they enter say 03/20/08 and it adds 14, currently it does not know that a new month will begin before this two week period ends. I could probably figure it out with a bunch of loops or case statements but I'm just wandering if there's like an opposite function to datediff. OR if theres a function OF datediff that i have not recognized yet that will do this. I use it to calc the seconds right now between the two dates and get my info from there... i haven't tried much else...

any thoughts or tips you experts could give me?

Adding 100 Year To A Date?
Hi there,

I am writing a valdiation application for a document workflow system.
I hae to generate a retention duraition fr every document. This si the time the document should be kept physicaly in store. But i can't find how i should add 12 months to an existing date. for example the retention periode is 12 month. When the document is scanned the retention duration should be current date + 12 months.

Anyone ????

thanks in advanced

Feurich

Adding Seconds To Date?
I have a value in seconds which I want to add to the predefined "Now" value, for example if it's now 12:00:00 PM and I have a variable x with a value of 120, I want to end up with 12:02:00 PM, how do I do this? Thanks

Edit: Found it, it's the DateAdd function.

Adding Date Range
I currently have a date range from 7/16/75 to now. I want to have this so that there are 2 ranges...such as 7/16/75-1/15/00 and 2/1/00-now. I need to see the total elapses time by combining the two ranges. should be simple enough to add two variables for the new dates but I don't know how. Thanks in advance!!


Code:
Public Sub T() 'Calculates elapsed time

Dim Years As Integer, Months As Integer, Days As Integer
Dim StartDate As Date, EndDate As Date

StartDate = "7/16/75"
EndDate = Now

Days = DateDiff("d", StartDate, EndDate)

Years = DateDiff("yyyy", StartDate, EndDate)
If DateAdd("yyyy", Years, StartDate) > EndDate Then
Years = Years - 1
End If

Months = DateDiff("m", StartDate, EndDate)
If DateAdd("m", Months, StartDate) > EndDate Then
Months = Months - 1
End If
Months = Months - (Years * 12)

Days = DateDiff("d", DateSerial(Year(EndDate), Month(EndDate), Day(StartDate)), EndDate) + 1
If Days < 0 Then
Days = Day(DateSerial(Year(EndDate), Month(EndDate), 0)) + Days
End If
Debug.Print Years
Debug.Print Months
Debug.Print Days

End Sub

Adding To And Subtracting From A Date
Lets say I have a date like: 10/31/2006

I need to both add one year to that date and subtract one year from that date so that I will wind up with three dates:

10/31/2005
10/31/2006
10/31/2007

I tried doing a +12 and a -12 but that didn't work the way I need it to. Is this a datediff thing?

Adding One Day In Current Date
Hi all

I wont to add one more day in my system current date.
For example I have the variable ddate as date and I give to this ddate variable
the date of the system with "ddate = now" how I can add one more day,
so if it is the ddate = '01/01/2006' the ddate to be ddate+1 and the msgbox command show '02/01/2006'. the date format I use is dd/mm/yyyy

Thank you for your help

Adding Months To A Date.
I have placed a date from a calender to a textbox using

Text1.Text = Format$(Calendar1.Value, "dd/mm/yy")

however, if i wanted to add say 12 months to the date and output it to a different textbox, how would i do that?

Any insights would be appreciated..

Adding An INT To Date And Time
hey Guys/Gals,

I'm in need of some code that will allow me to record the current date and time, add an INT to the hours part then when that time arrives then do something,

so say time is 9:35am 27/10/2005 so i add say 11 hours to it to make 8:35pm 27/10/2005

so in a timer i have somthing to check that time (8:35pm 27/10/2005) and once it has passed that time and date it will do something..



Edited by - Dubbois on 10/26/2005 5:07:28 PM

Adding Years To Date?
Hi, I'm having problem trying to figure out how to add years to the date which is stored in the database. Is there a proper way to do that? I tried multiplying it by 365 days and it still gives me an error in calculation.
Thanks in advance

Copyright 2005-08 www.BigResource.com, All rights reserved