Page 1 of 1

Want to generate user code to print the todays date

Posted: Tue Apr 16, 2019 5:56 pm
by reach2shrikant
I want to write a code which generate todays date and from that I have to generate the date coded password.

Which method I use out following two options:
1. New Method with argument 'RepoItemInfo'
2. New Method with argument 'Adapter'

Once the date is generated, I have to generate date coded passcode using following formula:
Password = (((Month*31)+(day*day))*137)+(((year-2000)*16)+5987)

Re: Want to generate user code to print the todays date

Posted: Wed Apr 17, 2019 7:38 am
by odklizec
Hi,

Basically, you can use something like this:
int curDateDay = System.DateTime.Now.Day;
int curDateMonth = System.DateTime.Now.Month;
int curDateYear = System.DateTime.Now.Year;
int password = (((curDateMonth*31)+(curDateDay*curDateDay))*137)+(((curDateYear-2000)*16)+5987);
As long as you don't want to use a repo element in your password obtaining method, you don't have to use any of the two arguments you mentioned.