Is there such a creature that will convert system date to julian date, convert variable to julian date?? Do the date functions interpret dates correctly no matter what system settings are on the serving or client machines?
here are two VBA functions I have
Maybe you coudl make them work in VBScript
----------------------------------------------
the first convert normal date to Julian 12/03/1999 to 990312
Function NormalToJulian(Date1)
Dim NormalDate As Date 'The serial date.
Dim DateYear As String 'The year of the serial date.
Dim JulianDay As String
Dim JulianDate As String 'The converted Julian date value
DateYear = Format(Date1, "yyyy" 'Find the year number for NormalDate
JulianDay = Format(Str(Date1 - DateValue("1/1/" & Str(DateYear)) + 1), "000"
'Combine the year and day to get the value for JulianDate.
JulianDate = DateYear & JulianDay
NormalToJulian = JulianDate
End Function
------------------------------------------------
Second function converts Julian to Normal 990312 to 12/03/1999
Sub Convert_date()
Dim dtmNewDate As Date
Dim strJulianDate As String
strJulianDate = wrkRqmtDate
dtmNewDate = DateSerial(Left$(strJulianDate, 2), 1, 1)
dtmNewDate = DateAdd("d", Val(Right$(strJulianDate, 3)) - 1, dtmNewDate)
wrkRqmtDate = ""
wrkRqmtDate = Format(dtmNewDate, "mm/dd/yyyy"
End Sub
------------------------------------------------
DougP, MCP
The DateSerial function syntax has these named arguments:
Part Description
year Required; Integer. Number between 100 and 9999, inclusive, or a numeric expression.
month Required; Integer. Any numeric expression.
day Required; Integer. Any numeric expression.
The DatePart function syntax has these named arguments:
Part Description
interval Required. String expression that is the interval of time you want to return.
date Required. Variant (Date) value that you want to evaluate.
firstdayofweek Optional. A constant that specifies the first day of the week. If not specified, Sunday is assumed.
firstweekofyear Optional. A constant that specifies the first week of the year. If not specified, the first week is assumed to be the week in which January 1 occurs.
Settings
The interval argument has these settings:
Setting Description
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second
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.