Tips.gif (2048 bytes)

 

 

 

 

 

Convert Julian to Date in Active Server Pages VB Script

Here's yet another variation of the julian convert. ASP has a slightly different coding format, even from VB or Excel.

When you need to get JDE records between two dates, do NOT convert all the JDE records to julian and match them up with a formatted date. It's much better to convert your parameters to julian and get them betweeen the two numbers, like "and STRDDJ between 105121 and 105152 "

Here's how todo it on a Microsoft Web Server (IIS):

set Conn=server.createobject("ADODB.Connection")
set rs=server.createobject("ADODB.recordset")
set cmd=server.createobject("ADODB.Command")
Conn.open "DSN=AS400ODBCNAME;UID=AS400USER;PWD=PWDUSER"

date1=now() ' Get today's date
JulDate=int((Year(date1) - 2000 + 100) * 1000 + date1 -datevalue("01/01/"&Year(date1))+1)

Now todays's date is a Julian, and you can say,

SQL="SELECT SDLITM,SDAEXP from F42119 where "

sql=sql+"SDIVD = "+str(juldate)

Conn.Execute SQL

Back to Mini Solve Products and other Tips