I tried using Dateadd('n',13,{fieldname})
.
but it throws an error not a valid date time field cause it is time field. is there any way to convert it to datetime and add the value and revert it into time field?
Thanks.
Try this formula:
DateAdd('n',13,DateTime(CurrentDate, {fieldname}))
The DateTime(date, time)
function will create a DateTime value that works in the DateAdd()
function. This will only work if the {fieldname}
is a Time data type though.
If {fieldname}
is a string, you will need to convert it to a Time data type first using the Time(time)
function.
The formula I suggested above will append your time value to today's date. You will then need to format the DateTime value it returns to only display the time value. This can be done by right clicking the field in your crystal report and clicking Format Field and setting the Style on the Date and Time tab.