You need to sign in to do that
Don't have an account?
ahadipanah
Remove Spaces, characters from CloseDate
Hello,
I'm new to the forums so apologizes if this post isn't in the correct spot.
I'm basically looking for a way to generate the ClosedDate as a custom field as either 7-14-2011-440PM or just 7142011440PM instead of 7/14/2011 4:40 PM.
Any help would be much appreciated. Thanks!
If you are doing it in Apex,
Do something like this:
Hope it helps. :)
All Answers
If you want to use a formula field you can do it like this
Add a formula field of Text Return type
If you want to write a trigger I can help you in that also
When we get the date field in apex then it is returned in this type of format
Now if you want to remove the ":" and " " from the date and get it in string then you can do something like this :
So this will satisfy your first format "7-14-2011-440PM"
Now if you want to remove everything between the date then you can try this :
It will provide you the date in this format : "7142011440PM"
This is all about how you can do this in apex, if you want to do this in formula then you can use SUBSTITUTE as suggested by Shashikant.
SUBSTITUTE is similar to replace. We can not use replace in formula.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
If you are doing it in Apex,
Do something like this:
Hope it helps. :)
Thanks all for the solutions! Much appreciated!