Login   Search
Skip Navigation Links
Home
Application Security Tips
Oracle , PL/SQL
IT Product Reviews
Project Management
Forum
Contact Us
Links & References
Avoid SQL Injection attack
Threats and Countermeasures: S.T.R.I.D.E
Input Validation
Session Management
Authentication Mechanism
Cross Site Scripting Vulnerabilities
Configuration Management
Scroll up
Scroll down
Oracle 9i - Programming basics PL/SQL
PL/SQL - Conditional Statements – IF
PL/SQL -Nested Block
LOOPS in PL/SQL
PL/SQL Records
Cursors in PL/SQL
PL/SQL Tables
PL/SQL Exceptions
PL/SQL Procedures
PL/SQL Functions
Oracle supplied packages
Packages
PL/SQL Ref Cursors
Types in Oracle PL/SQL
Varrays
Nested Table
Bfile and LOBs
Bulk Binding
Know Depandencies
PL/SQL Wrapper
Triggers
Scroll up
Scroll down
DBMS_SQL package
DBMS_DDL Package
DBMS_JOB Package
UTL_FILE Package
DBMS_METADATA Package
DBMS_PIPE Package
DBMS_SESSION Package
Scroll up
Scroll down

 

Blog

  • Imperativeness of agile methodology in software development
  • Get list of installed softwares on machines in your network
  • VMWare - Error - the vmware authorization service is not running
  • Add chart / graphs in ASP.net application / website
  • Microsoft Ramp Up

Blog

  • Review: uCertify.com: PrepKit for: 70-529 (C#)
  • Bird eye Review: uCertify.com: PrepKit for: 70-529 (C#)
Skip Navigation Links>Forum

Discussion forum

Discussion forum & Query resolution 

Generate a Julian Date in VB 6.0

AuthorBody
anonymous
5/13/2010 12:15 PM
Use this function:

Public Function CommonGetJulianDate(ByVal payYear As Long, payDate As Date)

'Return the 3 digit julian date

Dim JulianDate As String

'Dim CurrentYear As Long

'CurrentYear = Year(Now)

JulianDate = CStr(DateDiff("d", "1/1/" & payYear, payDate) + 1)

Do While Len(JulianDate) < 3

JulianDate = "0" & JulianDate

Loop

CommonGetJulianDate = JulianDate

End Function
anonymous
5/13/2010 12:16 PM
One more way:

' -----------------------------------------------------------------------------

Public Function CommonGetJulianDate(ByVal payYear As Long, payDate As Date) As String

'Return the 3 digit julian date

Dim JulianDate As String

'Dim CurrentYear As Long

'CurrentYear = Year(Now)

JulianDate = CStr(DateDiff("d", "1/1/" & payYear, payDate) + 1)

Do While Len(JulianDate) < 3

JulianDate = "0" & JulianDate

Loop

CommonGetJulianDate = JulianDate

End Function

'This function is to convert to julian date with ""YY"" + Julian days

Function julianDateConvert(theDate) As String

' Arg: A date with year

' Returns: Julian date version of passed date

Dim monthLen() As Integer

Dim myMonth As Integer

Dim i As Integer

Dim numDays As Integer

If Not IsDate(theDate) Then

Debug.Print "Invalid Date"

Else

ReDim monthLen(1)

monthLen(1) = 31

ReDim Preserve monthLen(2)

If Year(theDate) Mod 4 = 0 Then

monthLen(2) = 29

Else

monthLen(2) = 28

End If

ReDim Preserve monthLen(3)

monthLen(3) = 31

ReDim Preserve monthLen(4)

monthLen(4) = 30

ReDim Preserve monthLen(5)

monthLen(5) = 31

ReDim Preserve monthLen(6)

monthLen(6) = 30

ReDim Preserve monthLen(7)

monthLen(7) = 31

ReDim Preserve monthLen(

monthLen( = 31

ReDim Preserve monthLen(9)

monthLen(9) = 30

ReDim Preserve monthLen(10)

monthLen(10) = 31

ReDim Preserve monthLen(11)

monthLen(11) = 30

myMonth = Month(theDate)

For i = 1 To myMonth - 1

numDays = numDays + monthLen(i)

Next i

numDays = numDays + Val(Format$(theDate, "dd"))

julianDateConvert = Format$(theDate, "yy") & Format$(numDays, "000")

End If

End Function



Designed & Developed by Rahul Bagal