Wrox Home  
 
Search P2P Archive for  go

More Wrox Resources

  Return to Index  

asp_web_howto thread: Create code from date


Message #1 by "John P. Miller" <jpmiller@a...> on Mon, 28 Jan 2002 15:26:31 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_0007_01C1A810.29DD5A00

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



I have an application that uses an ID for certain items. The first two 

digits of the ID are the current fiscal year (01, 02). The year changes 

July 1st. Currently I have the code for this ID hard codes as 01, is 

there a way to code this into an if statement to get the ID?

Well I'm sure there is, but I'm not sure how.



Thanks in advance,

John Miller

jpmiller@a...








Message #2 by "phil griffiths" <pgtips@m...> on Tue, 29 Jan 2002 16:14:52
how about something like this:

if year(now) > 6 then ' must be 1 july or later

  thisYear = year(now)

else

  thisYear = year(now) - 1

end if

nextYear = thisYear + 1

id = right(cstr(thisYear), 2) & right(cstr(nextYear), 2)



HTH

Phil

> This is a multi-part message in MIME format.

> 

> ------=_NextPart_000_0007_01C1A810.29DD5A00

> Content-Type: text/plain;

> 	charset="iso-8859-1"

> Content-Transfer-Encoding: quoted-printable

> 

> I have an application that uses an ID for certain items. The first two 

> digits of the ID are the current fiscal year (01, 02). The year changes 

> July 1st. Currently I have the code for this ID hard codes as 01, is 

> there a way to code this into an if statement to get the ID?

> Well I'm sure there is, but I'm not sure how.

> 

> Thanks in advance,

> John Miller

> jpmiller@a...

> 

> 

> ------=_NextPart_000_0007_01C1A810.29DD5A00

> Content-Type: text/html;

> 	charset="iso-8859-1"

> Content-Transfer-Encoding: quoted-printable

> 

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

> <HTML><HEAD>

> <META http-equiv=3DContent-Type content=3D"text/html; 

> charset=3Diso-8859-1">

> <META content=3D"MSHTML 5.50.4912.300" name=3DGENERATOR>

> <STYLE></STYLE>

> </HEAD>

> <BODY bgColor=3D#ffffff>

> <DIV><FONT size=3D2>I have an application that uses an&nbsp;ID for 

> certain items.

> The first two digits of the&nbsp;ID are the current fiscal year (01, 

> 02). The

> year changes July 1st. Currently I have the code for this&nbsp;ID hard 

> codes as

> 01, is there a way to code this into an if statement to get the 

> ID?</FONT></DIV>

> <DIV><FONT size=3D2>Well I'm sure there is, but I'm not sure 

> how.</FONT></DIV>

> <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> <DIV><FONT size=3D2>Thanks in advance,</FONT></DIV>

> <DIV><FONT size=3D2>John Miller</FONT></DIV>

> <DIV><FONT size=3D2><A

> 

href=3D"mailto:jpmiller@a...">jpmiller@a...</A></

> FONT></DIV>

> <DIV>&nbsp;</DIV></BODY></HTML>

> 

> ------=_NextPart_000_0007_01C1A810.29DD5A00--

> 

Message #3 by "phil griffiths" <pgtips@m...> on Tue, 29 Jan 2002 16:16:55
LOL, should have been if month(now) > 6 ... 



Phil

> how about something like this:

> if year(now) > 6 then ' must be 1 july or later

>   thisYear = year(now)

> else

>   thisYear = year(now) - 1

> end if

> nextYear = thisYear + 1

> id = right(cstr(thisYear), 2) & right(cstr(nextYear), 2)

> 

> HTH

> Phil

> > This is a multi-part message in MIME format.

> > 

> > ------=_NextPart_000_0007_01C1A810.29DD5A00

> > Content-Type: text/plain;

> > 	charset="iso-8859-1"

> > Content-Transfer-Encoding: quoted-printable

> > 

> > I have an application that uses an ID for certain items. The first two 



> > digits of the ID are the current fiscal year (01, 02). The year 

changes 

> > July 1st. Currently I have the code for this ID hard codes as 01, is 

> > there a way to code this into an if statement to get the ID?

> > Well I'm sure there is, but I'm not sure how.

> > 

> > Thanks in advance,

> > John Miller

> > jpmiller@a...

> > 

> > 

> > ------=_NextPart_000_0007_01C1A810.29DD5A00

> > Content-Type: text/html;

> > 	charset="iso-8859-1"

> > Content-Transfer-Encoding: quoted-printable

> > 

> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

> > <HTML><HEAD>

> > <META http-equiv=3DContent-Type content=3D"text/html; 

> > charset=3Diso-8859-1">

> > <META content=3D"MSHTML 5.50.4912.300" name=3DGENERATOR>

> > <STYLE></STYLE>

> > </HEAD>

> > <BODY bgColor=3D#ffffff>

> > <DIV><FONT size=3D2>I have an application that uses an&nbsp;ID for 

> > certain items.

> > The first two digits of the&nbsp;ID are the current fiscal year (01, 

> > 02). The

> > year changes July 1st. Currently I have the code for this&nbsp;ID hard 



> > codes as

> > 01, is there a way to code this into an if statement to get the 

> > ID?</FONT></DIV>

> > <DIV><FONT size=3D2>Well I'm sure there is, but I'm not sure 

> > how.</FONT></DIV>

> > <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> > <DIV><FONT size=3D2>Thanks in advance,</FONT></DIV>

> > <DIV><FONT size=3D2>John Miller</FONT></DIV>

> > <DIV><FONT size=3D2><A

> > 

> 

href=3D"mailto:jpmiller@a...">jpmiller@a...</A></

> > FONT></DIV>

> > <DIV>&nbsp;</DIV></BODY></HTML>

> > 

> > ------=_NextPart_000_0007_01C1A810.29DD5A00--

> > 

Message #4 by "Pat Waddington" <paw@s...> on Tue, 29 Jan 2002 09:22:00 -0000
This is a multi-part message in MIME format.



------=_NextPart_000_001E_01C1A8A6.67E23500

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



You could try Javascript

  ----- Original Message -----

  From: John P. Miller

  To: ASP Web HowTo

  Sent: Monday, January 28, 2002 8:26 PM

  Subject: [asp_web_howto] Create code from date





  I have an application that uses an ID for certain items. The first two 

digits of the ID are the current fiscal year (01, 02). The year changes 

July 1st. Currently I have the code for this ID hard codes as 01, is 

there a way to code this into an if statement to get the ID?

  Well I'm sure there is, but I'm not sure how.



  Thanks in advance,

  John Miller

  jpmiller@a...






$subst('Email.Unsub').






Message #5 by "O'Hara, Elliott M" <EMOHARA@k...> on Wed, 30 Jan 2002 09:44:48 -0500
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C1A99C.AE44211E

Content-Type: text/plain;

	charset="iso-8859-1"



lol...

you could "try" javascript????

Come on pat..... 

Can't we do better than that?

:~)

 

John,

    Try something like this (ASP)...

 

function creatFirst2ID()

    if month(date)<7 then 

creatFirst2ID =  right(CInt(year(date))-1,2) 

    else 

creatFirst2ID = right(year(date),2) 

end if

end function

 

should do ya....



-----Original Message-----

From: Pat Waddington [mailto:paw@s...]

Sent: Tuesday, January 29, 2002 4:22 AM

To: ASP Web HowTo

Subject: [asp_web_howto] Re: Create code from date





You could try Javascript



----- Original Message ----- 

From: John P. Miller <mailto:jpmiller@a...>  

To: ASP Web HowTo <mailto:asp_web_howto@p...>  

Sent: Monday, January 28, 2002 8:26 PM

Subject: [asp_web_howto] Create code from date



I have an application that uses an ID for certain items. The first two

digits of the ID are the current fiscal year (01, 02). The year changes July

1st. Currently I have the code for this ID hard codes as 01, is there a way

to code this into an if statement to get the ID?

Well I'm sure there is, but I'm not sure how.

 

Thanks in advance,

John Miller

jpmiller@a... <mailto:jpmiller@a...> 

 




$subst('Email.Unsub'). 






$subst('Email.Unsub'). 







  Return to Index