Script not working

Hi,

I have written the following script–

scyr$ = Cstr(Year(doc.SCAssignOnDate(0)))

	scmon$=	Cstr(Month(doc.SCAssignOnDate(0)))

	scday$=	Cstr(Day(doc.SCAssignOnDate(0)))		

	schr$=	Cstr(Hour (doc.SCAssignOnTime(0)))

	scmin$=	Cstr(Minute(doc.SCAssignOnTime(0)))

	scsec$=	Cstr(Second(doc.SCAssignOnTime(0)))

	

	scnewDateTime$ =scyr$+scmon$+scday$+schr$+scmin$+scsec$

	'newDateTime =Cdat(scnewDateTime)

	

	Msgbox Cdat(scnewDateTime$)

but its giving an error–“Type mismatch”

Pls help me…

Subject: Script not working

Which line are you getting the type mismatch on?

When building scnewDateTime$, I imagine you will probably have to include seperators! Otherwise the value of the string will be something like…

20080116075900

Also, why are you building the NotesDateTime like that? Why not just have

newDateTime=new NotesDateTime(doc.SCAssignOnTime(0))

Mike

Subject: RE: Script not working

Hi…

Thanks for your response.Actually I am having 2 date/time fields.

SCAssignOnDate–which stores date

SCAssignOnTime–which stores time

I am trying to get the total time value from these 2 fields and capture in a variable like 2008/01/06 4:34:50

also i am getting the error in Msgbox Cdat(scnewDateTime$)

Pls suggest me a solution for that…

Subject: RE: Script not working

try this approach

Dim dt3 As New NotesDateTime(SCAssignOnDate.DateOnly & " " & SCAssignOnTime.TimeOnly)

Msgbox dt3.LocalTime

hope it will help you

Subject: RE: Script not working

I don’t understand what you mean by “total time value”

Do you mean the difference between 2 dates?

Subject: Script not working

cdat( ) - expects a number

From help:

The integer part represents a serial day counted from Jan 1, 100 AD. Valid dates are represented by integer numbers in the range -657434, representing Jan 1, 100 AD, to 2958465, representing Dec 31, 9999 AD. The fractional part represents the time as a fraction of a day, measured from time 00:00:00 (midnight on the previous day). In this representation of date/time values, day 1 is the date December 31, 1899.

Converting today’s date and time to 20080116090000 is not a number that it understands and that’s why you’re gettnig the error.

SCAssignOnDate–which stores date

SCAssignOnTime–which stores time

I am trying to get the total time value from these 2 fields and capture in a variable like 2008/01/06 4:34:50

If you have two fields A Date and Time and you want to get it as a true date time value… All you need to do is:

Dim SCAssignOnDateTime as NotesDateTime

rest of your code

Set SCAssignOnDate = New NotesDateTime( doc.SCAssignOnDate(0).DateOnly + " " + doc.SCAssingOnDate(0).TimeOnly )

Or all in one step:

Dim SCAssignOnDateTime AS New NotesDateTime( doc.SCAssignOnDate(0).DateOnly + " " + doc.SCAssingOnDate(0).TimeOnly )