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

Epoch Time Convert

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

    Epoch Time Convert

    Need help pls.

    i want to convert a EPOCH Time eg( 1264658850 )
    to a date/time format eg( 01/28/2010 02:07:26 00 PM )

    tnx.
    "Knowledge without application is useless."

    #2
    Re: Epoch Time Convert

    I looked and there is no built in function. So you would have to find the forumla, or sample code from some other language and adapt to Xbasic, write a function.
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: Epoch Time Convert

      Originally posted by nehru
      Need help pls.

      i want to convert a EPOCH Time eg( 1264658850 )
      to a date/time format eg( 01/28/2010 02:07:26 00 PM )

      tnx.
      Basic formula is

      ?ctodt("01/01/1970")+1264658850+(gettimezoneoffset()*3600)
      = 01/28/2010 01:07:30 00 am

      I can't account for the 11 hour difference in your time, but I suspect it is due to some issue with the time zone or daylight savings time that you didn't account for in the conversion you gave

      The seconds do not account for leap seconds. If you want to do that, you'll need a function to process those leap seconds. If you are just subtracting 2 times, the seconds don't matter if you don't cross a leap second date.
      Last edited by csda1; 01-28-2010, 10:05 AM.
      Regards,

      Ira J. Perlow
      Computer Systems Design


      CSDA A5 Products
      New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
      CSDA Barcode Functions

      CSDA Code Utility
      CSDA Screen Capture


      Comment


        #4
        Re: Epoch Time Convert

        Code:
        ?{1/1/70}+[b]1264658850[/b]/86400
        = {01/28/2010}
        edit...
        Just noticed you want date/time. Will catch up with you later, have to go to a meeting...
        Last edited by G Gabriel; 01-28-2010, 10:23 AM.

        Comment


          #5
          Re: Epoch Time Convert

          Subject to further testing, I think this UDF should do it:
          Code:
          FUNCTION Epoch_to_DT AS A (epoch_date AS N )
          	d={1/1/70}+epoch_date/86400
          	x=mod(epoch_date,86400)
          	hs=int(x/3600)
          	ms=int(mod(x,3600)/60)
          	ss=mod(mod(x,3600),60)
          	dd=d+" "+padl(hs+"",2,"0")+":"+padl(ms+"",2,"0")+":"+padl(ss+"",2,"0")
          Epoch_to_DT=ctodt(dd)
          END FUNCTION
          P.S.
          Doesn't account for leap seconds. I sure hope you are not adamant about leap seconds unless you work for NASA.
          Last edited by G Gabriel; 01-28-2010, 10:15 PM.

          Comment


            #6
            Re: Epoch Time Convert

            :D tnx for the help guys
            more power to all :)

            1 more help guys pls.

            how about in other way (reverse)
            date/time to EPOCH Time
            "Knowledge without application is useless."

            Comment


              #7
              Re: Epoch Time Convert

              Code:
              x=now()
              ?int(x-ctodt("01/01/1970 12:00:00 am"))
              = 1264751422

              Comment


                #8
                Re: Epoch Time Convert

                Truly amazing! I'm a retired scientist\engineer turned 65 and never heard of Epoch time until now. The breadth of knowledge in this forum never ceases to amaze me. Keep it up guys.

                Comment


                  #9
                  Re: Epoch Time Convert

                  tnx to all and specially to G Gabriel

                  more blessings to all and to our family.
                  i love this forum and my a5.

                  nehru
                  "Knowledge without application is useless."

                  Comment


                    #10
                    Re: Epoch Time Convert

                    For anyone else like myself who is ignorant of Epoch time and would like to know more about it, here's a good reference- http://www.esqsoft.com/javascript_ex...e-to-epoch.htm

                    Comment


                      #11
                      Re: Epoch Time Convert

                      I know this thread is a bit old, but I've just run into this issue. I have a PHP script that is entering the Epoch datetime into the database. I need to pull that number and convert it to a readable date/time. And then also be able to create a record and inserting the Epoch datetime into the database so the PHP script can read it.

                      So, I kinda understand what is happening here. But I'm not sure how to do it or where to enter the function. Any help would be appreciated.

                      Comment


                        #12
                        Re: Epoch Time Convert

                        Originally posted by dfricke10 View Post
                        I need to pull that number and convert it to a readable date/time. And then also be able to create a record and inserting the Epoch datetime into the database so the PHP script can read it.
                        Not sure which one(s) of these steps are you having trouble with. Post an example for further assistance.

                        Comment


                          #13
                          Re: Epoch Time Convert

                          Pretty much all of it. I have a field called date which has the epoch datetime format. Just trying to convert it to readable date time from the records saved already from the PHP script, and then when the user through A5 saves a new record, it store the epoch datetime from the readable date time. Make sense? I understand I need a function, but don't know where to put it.

                          And yes, I'm still new to Alpha. :)

                          Comment


                            #14
                            Re: Epoch Time Convert

                            Update:
                            I've got the script to display the datetime from the current epoch field using:
                            ctodt(dtoc(date() ) + " " + time() )
                            in the Display Format of the date field. Converts nicely. Now to get it so when the user adds a new record, it converts the readable datetime to epoch and stores it.

                            This would be a hidden field on the New Record screen.

                            Comment


                              #15
                              Re: Epoch Time Convert

                              One way is to put it in a calc field, or
                              You could add another field to your table then with an update operation populate it using the epoch function.

                              Comment

                              Working...
                              X