Thanks:  0
Likes:  0
Dislikes:  0

# Thread: Getting a Julian Date.

1. ## Getting a Julian Date.

Is there a command within silktest that retuns the Julian date? Cannot seem to find anything relating to this.

Cheers.

------------------

2. ## Re: Getting a Julian Date.

Hi ,

What my understanding of a Julain Date is :
Julian dates are used to show the number of days that have passed and/or that are left in a given year.
A Julian date format is : yyddd , where 'yy' is the year and 'ddd' is the day of the year.

So , given the fact that we wanna calulate the days left in the given year , you could use the following code to return this value : [ This is VB code - you can translate it into 4Test script ] .

'This procedure will return the number of days left in the current
year.
Sub DaysLeft()
Dim JanNextYear As Date 'January 1 of next year
Dim JanCurrentYear As Date 'January 1 of current year
Dim DayNum As Integer 'Number of the current day
Dim DaysLeftInYear As Integer 'Days left in the current year

JanNextYear = DateSerial(1 + Year(Now), 1, 1)
JanCurrentYear = DateSerial(Year(Now), 1, 1)
DayNum = Int(((Now / 365.255) - (Year(Now) - 1900)) * 365.255)
DaysLeftInYear = JanNextYear - JanCurrentYear - DayNum

'Display the value of DaysLeftInYear
MsgBox "Days left in the year: " & DaysLeftInYear
End Sub

And for calculating the number of days passed , use the following code : [ This is VB code - you can translate it into 4Test script ] .

'This procedure will return the number of days that
'have passed since January 1 of the current year.
Sub DaysPassed()
Dim DayOfYear As Integer 'Number of the current day

DayOfYear = Int(((Now / 365.255) - (Year(Now) - 1900)) * 365.255)

'Display the value of DayOfYear
MsgBox "Day of the year: " & DayOfYear
End Sub

Hope this helps!!!!

Regards,

Grover.

------------------

3. ## Re: Getting a Julian Date.

try the following:

look up FormatDateTime in the language ref.

------------------

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.