I don't have VB5 but VB6. In VB6 it's possible to use the function cdate<br>
example:<br>
<br>
Private Sub Command1_Click()<br>
MsgBox CDate(36502)<br>
End Sub<br>
<br>
rgds<br>
<br>
Marc
My flat file shows a 2 digit year (99347). I did get this converted, but now need to convert the user's input from mm/dd/yyyy to julian to match against the file. Oh what a tangled web we weave! Anyway, should I try to do that using CDate?<br>
<br>
Here is my code to convert my julian date to the printable data:<br>
Sub Convert_date()<br>
Dim dtmNewDate As Date<br>
Dim strJulianDate As String<br>
strJulianDate = wrkRqmtDate<br>
dtmNewDate = DateSerial(Left$(strJulianDate, 2), 1, 1)<br>
dtmNewDate = DateAdd("d", Val(Right$(strJulianDate, 3)) - 1, dtmNewDate)<br>
wrkRqmtDate = ""<br>
wrkRqmtDate = Format(dtmNewDate, "mm/dd/yyyy"<br>
End Sub
Here's way to covert normal date to Julian if anyones interested.<br>
Function NormalToJulian(Date1)<br>
Dim NormalDate As Date 'The serial date.<br>
Dim DateYear As String 'The year of the serial date.<br>
Dim JulianDay As String<br>
Dim JulianDate As String 'The converted Julian date value<br>
<br>
DateYear = Format(Date1, "yyyy" 'Find the year number for NormalDate<br>
JulianDay = Format(Str(Date1 - DateValue("1/1/" & Str(DateYear)) + 1), "000"<br>
<br>
'Combine the year and day to get the value for JulianDate.<br>
JulianDate = DateYear & JulianDay<br>
<br>
NormalToJulian = JulianDate<br>
End Function<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.