Hello All,
I have a date coming to my application and within the application I need to convert date format using regex. Could some one help me.
my input date could be any of following...
this is just an example date
12/12/12
1/12/12
12/1/12
12/12/2012
1/12/2012
12/1/2012
and my desired output should be 12/12/2012 (dd/mm/yy).
For example, if input date is (18/7/12) I will need to convert that to 18/07/2012.
Thanks
date format help
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Are dates the only things containing digits in your text?
If so, try the following:
0. Use "Posix" regular expression syntax:
If so, try the following:
0. Use "Posix" regular expression syntax:
1. Inset a leading zero in front of single digits:Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
2. Insert 20 in front of 2-digit years:Find what: \<([0-9])\>
Replace with: 0\1
[X] Regular expression
Replace All
Find what: \<([0-9][0-9]/[0-9][0-9])/([0-9][0-9])\>
Replace with: \1/20\2
[X] Regular expression
Replace All