Removing time stamp

Hi everyone Im using the type into activity to insert a date from excel but keep getting the time stamp “00:00:00” I used (row(4).tostring.indexof(" ")) but get this error "option Strict On disallows implicit conversions from ‘integer’ to ‘string’ what is the proper way to write it out?

Hi.

It sounds like you want to format the date. You can look this up too, but it’s basically the same as the formattings you would find in Excel for example. So for a date, you might use “MM/dd/yyyy”. But, you also want to make sure that the value is a date type or it won’t let you format it.

Maybe you can use something like this:

If activity: isDate(row(4))
    TypeInto Convert.ToDateTime(row(4)).ToString("MM/dd/yyyy")

You can also use the .net method to get the shortdatestring. I believe you would do same thing but change the .ToString() part.
ConvertToDateTime(row(4)).ToShortDateString

Hope that helps.

Regards.

4 Likes

i get this error To.Date is not a member of System.Convert

Try Convert.ToDateTime()
Also, it will list all the members when you type a period

1 Like

Hi @seanp92

to me, It sounds like you are extraxting some date from Excel file cell ( and your variable is Generic type) and it gives you that sufix “00:00:00”.
If that is the case you can always use something like: variable.toSting.Trim.Replace(" 00:00:00",“”)

Hope this helps! :smiley:

1 Like

its saying ConverttoDateTime is not declared

1 Like

You might have a typo. Make sure you type it out correctly. Post an image of what you have if you need me to look at it. Regards.

1 Like

like this row(4).tostring.trim.replace(“00:000:00”, “”)?

2 Likes

image

1 Like

Try (Convert.ToDateTime(row(4)).ToShortDateString

Dates.xaml (5.6 KB)

3 Likes

Did you get this fixed? Looking at your image, you have toSting instead of toString.
Make sure you don’t have any typos :smiley:
Also, your image cut off the compiler error, so I’m just guessing.

I also don’t recommend using the Replace method, because you should manage dates as dates, so you can make sure that your input is of a date type before inputting it into the system.

Check previous posts about how to convert the string to a DateTime.
Convert.ToDateTime(row(4)).ToShortDateString
or
Convert.ToDateTime(row(4)).ToString("MM/dd/yyyy")
where you can set your own format

Additionally, before that, I highly recommend that you check if it’s a date before inputting the value or it can cause glitches if the input data is wrong. If activity: IsDate(row(4))
EDIT: in the Else you can Throw a BusinessRuleException so when input is wrong, your robot will tell you. Do some searches on how to Throw that type of an exception.

If you get any errors, please post them, and we’ll help get it solved :smiley:

Regards.

2 Likes

This worked wonderfully to get rid of pesky time stamps when extracting dates from an excel report to input in a website. Many thanks!

1 Like

Hello, I think you can just use a third-party watermark tool to remove the time stamp, you can try Easepaint Watermark Expert, this tool can remove/add any logo you want to the photos and videos. Hope it helps.

Cool trik :wink: It works for me.

Thanks, It works for me Too…