Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Month-Year Date Format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Month-Year Date Format

    I have read through most of the threads that have related to Date format. I need to have a field that can be index by
    a date format that contains Month-Year [example Jan-01]. Is this possible?


    Your replies will be appreciated.

    Bob Sprague

    #2
    RE: Month-Year Date Format

    Robert,

    I think this could be turned around

    STR(YEAR(DATE))+CMONTH((DATE))

    This is used on an index by one of my apps

    Dave

    Comment


      #3
      RE: Month-Year Date Format

      Dave,

      Thank you, I will give it a try.

      Bob

      Comment


        #4
        RE: Month-Year Date Format

        Can be simplified to:

        NOTE: "date> stands for the date variable but DON'T use "Date" as the variable name. It's too easy to get it confused with the date() function. (Trust me - I've been there!)

        cyear("date>) + cmonth("date>) BUT it really won't work correctly because January usually comes before February.

        To make this work to sort all months properly, you need to convert the month to a numeric string. To do this, I would suggest building a UDF (sample below) to convert the various month strings to a numeric month string. Then use this:

        cyear("date>) + MM_month("date>)

        FUNCTION MM_Month as C ( in_date as c )
        '---------------------------------------------------------------------
        ' THIS FUNCTION GIVES THE MONTH AS A 2 DIGIT NUMBER BEGINNING WITH
        ' "0" IF LESS THAN 10.
        ' THE ORIGINAL INPUT WAS INTENDED TO BE EITHER BLANK OR THE NAME OF
        ' THE MONTH BUT WAS LATER MODIFIED TO INCLUDE CHARACTER DATE VALUES.
        '---------------------------------------------------------------------
        SELECT
        CASE UL( in_date, 3 ) = "JAN"
        MM_Month = "01"
        CASE UL( in_date, 1 ) = "F"
        MM_Month = "02"
        CASE UL( in_date, 3 ) = "MAR"
        MM_Month = "03"
        CASE UL( in_date, 2 ) = "AP"
        MM_Month = "04"
        CASE UL( in_date, 3 ) = "MAY"
        MM_Month = "05"
        CASE UL( in_date, 3 ) = "JUN"
        MM_Month = "06"
        CASE UL( in_date, 3 ) = "JUL"
        MM_Month = "07"
        CASE UL( in_date, 2 ) = "AU"
        MM_Month = "08"
        CASE UL( in_date, 1 ) = "S"
        MM_Month = "09"
        CASE UL( in_date, 1 ) = "O"
        MM_Month = "10"
        CASE UL( in_date, 1 ) = "N"
        MM_Month = "11"
        CASE UL( in_date, 1 ) = "D"
        MM_Month = "12"
        CASE ELSE
        IF ctod( in_date ) = ctod( "14/44/2000" )
        'NEXT LINE REMMED OUT SO IT WILL WORK IN FIELD RULES
        ' ui_msg_box( "*** INPUT ERROR ***", "Input date for the MM_Month function must be either blank, the name of the month, or a valid date string formatted as 'mm/dd' or 'mm/dd/yy' or 'mm/dd/yyyy' or 'dtoc( datevalue )'.", 16 )
        MM_Month = "00"
        EXIT FUNCTION
        END IF
        n = month( ctod( in_date ) )
        mm_month = right( "0" + ltrim(str(n)), 2 )
        END SELECT

        END FUNCTION

        Comment


          #5
          RE: Month-Year Date Format

          I just noticed that you said "a date [b]format[b] that contains Month-Year [example Jan-01]".

          My previous message assumed you were using a character string to store the 'date' variable because of the text value for the month. If you are storing the date in an actual date field and simply displaying it with that format, the field has to include the full date even if it isn't viewed that way.

          With a real DATE field, the index expression can be changed to:
          cyear("date>) + left( dtoc("date>), 2 )

          NOTE: the DTOC() function defaults to the mm/dd/yyyy format (although it might depend on your windows setting) but the function has the ability to accept a second argument that defines different display formats.
          Example: DTOC( date(), "3" ) would result in something like "26 November 2001"

          Comment


            #6
            RE: Month-Year Date Format

            Sorry, I forgot to turn off the bold.

            Comment


              #7
              RE: Month-Year Date Format

              Cal,

              Thank You!

              Bob

              Comment


                #8
                RE: Month-Year Date Format

                add on

                left(CMONTH((DATE)),3) + " " + right(STR(YEAR(DATE)),2) = Jan 01


                so we know for sure


                Thanks dave

                Comment


                  #9
                  RE: Month-Year Date Format

                  I don't understand how you could index with the first expression - you might have an index, but wouldn't it be useless.

                  ?str(year(date())) + cmonth(date())
                  = " 2001November"

                  ?str(year(date()),4,0) + padl(str(month(date()),2,0),2,"0")
                  = "200111"
                  Cole Custom Programming - Terrell, Texas
                  972 524 8714
                  [email protected]

                  ____________________
                  "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                  Comment


                    #10
                    RE: Month-Year Date Format

                    Martin,

                    since numbers always come first, it works fine

                    I have it in a table index now and have used it or the equivalent for a long time

                    Try it

                    Dave

                    Comment


                      #11
                      RE: Month-Year Date Format

                      Martin,

                      Beauty is in the eye of the beholder.

                      Dave must not need to produce a sorted list, top to bottom, in order by the months of each year. His 'alphabetical' approach probably meets his needs just fine. However, it won't produce the list in order like this:

                      2001January
                      2001February
                      2001March
                      2001April

                      ... since the month component in this list is not in alpha order.

                      -- tom

                      Comment


                        #12
                        RE: Month-Year Date Format

                        Tom is up early??

                        Dave

                        Comment


                          #13
                          RE: Month-Year Date Format

                          Yep, ... sign of a guilty conscience!

                          -- tom

                          Comment


                            #14
                            RE: Month-Year Date Format

                            I see what you mean.
                            Cole Custom Programming - Terrell, Texas
                            972 524 8714
                            [email protected]

                            ____________________
                            "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                            Comment

                            Working...
                            X