December 2012
Intermediate to advanced
316 pages
6h 51m
English
As already mentioned, regular expressions are useful for converting data into the required format. One good example is the conversion of a date stored in internal format into display format, and vice versa. For example, a date may be available as 20120101 and we need to format it in the form 01/01/2012, and so on. In this recipe, we will see how a single statement of replace may be used to carry out this task. For this recipe, we assum that input date is in the correct internal format.
For carrying out the previously mentioned conversion, proceed as follows:
mydate having a length of 10 characters. A date having the internal format date is then assigned to this variable. ...Read now
Unlock full access