Jump to content
Macro Express Forums

Date function in Macro express 3.5.5.2


nithyanantham

Recommended Posts

The first example is Macro Express code to produce the date in D M YYYY format. The code uses three integer variables, N1 (day), N2 (month), and N3 (year).

 

In the second example, the date outputs as D MMMM YYYY. Variables N1 and N3 are reused, but I change the month from integer variable N2 to text variable T1.

 

// D M YYYY Format:
Variable Set Integer %N1% from Current Day
Variable Set Integer %N2% from Current Month
Variable Set Integer %N3% from Current Year
Text Type: D M YYYY: %N1% %N2% %N3%

// D MMMM YYYY Format:
Switch (N2)
 Case: 1
   Variable Set String %T1% "January"
 End Case
 Case: 2
   Variable Set String %T1% "February"
 End Case
 Case: 3
   Variable Set String %T1% "March"
 End Case
 Case: 4
   Variable Set String %T1% "April"
 End Case
 Case: 5
   Variable Set String %T1% "May"
 End Case
 Case: 6
   Variable Set String %T1% "June"
 End Case
 Case: 7
   Variable Set String %T1% "July"
 End Case
 Case: 8
   Variable Set String %T1% "August"
 End Case
 Case: 9
   Variable Set String %T1% "September"
 End Case
 Case: 10
   Variable Set String %T1% "October"
 End Case
 Case: 11
   Variable Set String %T1% "November"
 End Case
 Case: 12
   Variable Set String %T1% "December"
 End Case
End Switch
Text Type: D MMMM YYYY: %N1% %T1% %N3%

Link to comment
Share on other sites

Your comment "date in a format that MEX doesn't support" made me curious so I studied help for the Date/Time command. There are a few predefined date/time formats but you can also type other formats in the Date/Time command. I cannot imagine a date/time format that Macro Express cannot do. Here are the two you mentioned:

Date/Time: Save "dd"-"MMMM"-"YYYY"-"hh"-"nn" into %T1%
Date/Time: Save "yydmm" into %T1%

Note that "nn" is used for minutes because "mm" represents the month.

Link to comment
Share on other sites

I hadn't realized it was possible to type in a date format. I wish I had known that years ago.

 

On the other hand, not knowing gave me more time to get familiar with Macro Express variables and conditional statements.

 

The comprehensiveness of Macro Express still surprises me at times.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...