gagangoomer Posted March 19, 2013 Report Share Posted March 19, 2013 Hi, I'm copying some fields from an application on which date format is in "mm/dd/yyyy" (ex. 03/01/2013)format but i want to customarize it to "mmmm dd',' yyyy" (ex. March, 01, 2013) format. The above value is stored in variable T[1] through Variable Set String t[1] from clipboard contents.I guess the desired results can be acheived by using modify Date/Time --> convert to text variable option or maybe some better option. But as the variable is intialized from clipboard but modify date/time uses Date/Time Variable(that means an existing variable defined in date/time format to modify). Please advice is there some better option of converting the date into the desired format ? Thanks in advance Gagan Quote Link to comment Share on other sites More sharing options...
Cory Posted March 19, 2013 Report Share Posted March 19, 2013 There is no simple way to convert text to a proper date/time variable so in this case I would simply rearrange the characters using string manipulations. Quote Link to comment Share on other sites More sharing options...
gagangoomer Posted March 19, 2013 Author Report Share Posted March 19, 2013 Cory, I didn't get you when you say rearranging the characters using string manipulations. How do we do it? Quote Link to comment Share on other sites More sharing options...
Cory Posted March 22, 2013 Report Share Posted March 22, 2013 Take the first 2 digits and do a select-case for the month name then take the 4th and 5th digit if the 4th is not a zero (5th only else) and then 7th thru 10th for the year. Then just put them all together in a new resultant string. Pretty simple really. Quote Link to comment Share on other sites More sharing options...
Samrae Posted March 25, 2013 Report Share Posted March 25, 2013 You might want to look at this sample macro: Date String to DateTime Variable. It looks like it does what you need. I think that if you get a date string into a DateTime variable you can output it in any date format you want. Quote Link to comment Share on other sites More sharing options...
terrypin Posted March 30, 2013 Report Share Posted March 30, 2013 Hmm, that raises an interesting puzzle here. I downloaded that macro file: On using File > Open File in ME Pro (4.4.1.1) I had a message I don't recall seeing before, namely that the file was 'from another computer' and was blocked for security. I clicked the Unblock button. But I'm still unable to access it. It's not shown in File > Open File > Browse. I even added extra Permissions but still not there. Edit: I haven't solved that mystery but I did get the file into ME Pro by d-clicking. That loaded the new macro and nothing else, so I opened my main macro file Full.mex, moved the new macro into an appropriate category within it, then finally closed the new file. But the macro seems buggy. Before running it I changed the example that the author used (11-12-12) to remove the ambiguity. I like days that are over 12 in this sort of demo! So lines 17-19 are now // Put the date in T10 in MM-DD-YY format// -------------------------------------------------------------------------------------Variable Set String %DateString% to "11-15-12" That gave the result 30/12/1899. --Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
Cory Posted April 2, 2013 Report Share Posted April 2, 2013 I'm not sure if it's related but another poster found a bug in the time calculations that had a similar result. But in this case the poster has string and needs a string so there's no need for all the complexity of converting to time variables. Quote Link to comment Share on other sites More sharing options...
gagangoomer Posted April 24, 2013 Author Report Share Posted April 24, 2013 I tried the macro referenced below. It does change the date format from MM-DD-YYY to MM/DD/YYYY but doesn't revert in a desired format.It didn't gave me any problem while loading the macro in MEP. Can anyone advice how to get the result in MMMM/DD/YYYY format ? Quote Link to comment Share on other sites More sharing options...
Samrae Posted April 24, 2013 Report Share Posted April 24, 2013 The Date String to DateTime Variable describes how this is done. Put a Date/Time command in an empty macro. Change it to return the format you want. Click to view it in the Direct Editor. Compare the command in the Direct Editor with the command in the sample macro. Change where needed. My guess is you need to change the Format="DD-MMM-YYYY" part. But you will need to read and then try it. Quote Link to comment Share on other sites More sharing options...
Samrae Posted April 24, 2013 Report Share Posted April 24, 2013 Terry: Did you adjust the macro to accomodate the different date format within Windows? I am guessing the macro was written with US English while you are likely configured for UK English with correspondingly different date formats. Quote Link to comment Share on other sites More sharing options...
gagangoomer Posted April 25, 2013 Author Report Share Posted April 25, 2013 I did changes the coding but failed to get the desired results. Instead i'm getting the result as 12/30/1899. Quote Link to comment Share on other sites More sharing options...
terrypin Posted April 25, 2013 Report Share Posted April 25, 2013 Samrae: I assume your question was to gagangoomer? Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
gagangoomer Posted April 26, 2013 Author Report Share Posted April 26, 2013 Yes, i did that but it is still not picking the correct value. Quote Link to comment Share on other sites More sharing options...
Cory Posted April 29, 2013 Report Share Posted April 29, 2013 I think it's more efficient to use my suggestion. There is no need to involve date/time variables at all. Just rearrange the characters in the string. Quote Link to comment Share on other sites More sharing options...
terrypin Posted June 8, 2013 Report Share Posted June 8, 2013 Hmm, that raises an interesting puzzle here. I downloaded that macro file: On using File > Open File in ME Pro (4.4.1.1) I had a message I don't recall seeing before, namely that the file was 'from another computer' and was blocked for security. I clicked the Unblock button. But I'm still unable to access it. It's not shown in File > Open File > Browse. I even added extra Permissions but still not there. Edit: I haven't solved that mystery but I did get the file into ME Pro by d-clicking. That loaded the new macro and nothing else, so I opened my main macro file Full.mex, moved the new macro into an appropriate category within it, then finally closed the new file. But the macro seems buggy. Before running it I changed the example that the author used (11-12-12) to remove the ambiguity. I like days that are over 12 in this sort of demo! So lines 17-19 are now // Put the date in T10 in MM-DD-YY format // ------------------------------------------------------------------------------------- Variable Set String %DateString% to "11-15-12" That gave the result 30/12/1899. -- Terry, East Grinstead, UK I reported this apparent bug at the time and have today received confirmation that it will be fixed in the next version. At least, that's what I'd like to conclude from the following, despite its puzzling inclusion of an 'IF'! Issue [iSS11698] submitted by you has been resolved. If a modification was made to Macro Express Pro to resolve this issue the change will be available with the next release of Macro Express Pro. -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.