Firebase: Get current time without writing to the database (IOS and ANDROID)Get Firestore Server Time and convert to DateTime without set/update data?How to save the current date/time when I add new value to Firebase Realtime DatabaseShip an application with a databaseHow can I connect to Android with ADB over TCP?“Conversion to Dalvik format failed with error 1” on external JARDownload a file with Android, and showing the progress in a ProgressDialogWhat is the simplest and most robust way to get the user's current location on Android?Get current time and date on Android“cannot resolve symbol R” in Android StudioHow can I send a Firebase Cloud Messaging notification without use the Firebase Console?What's the difference between Cloud Firestore and the Firebase Realtime Database?Android : Get current date and time from firebase

Pros and cons of writing a book review?

Is it OK to bring delicacies from hometown as tokens of gratitude for an out-of-town interview?

Is the decompression of compressed and encrypted data without decryption also theoretically impossible?

Avoiding cliches when writing gods

Is it a problem that pull requests are approved without any comments

Opposite of "Squeaky wheel gets the grease"

Linux tr to convert vertical text to horizontal

Count down from 0 to 5 seconds and repeat

I wrote a scene that the majority of my readers loved. How do I get back to that place while writing my new book?

Building a road to escape Earth's gravity by making a pyramid on Antartica

How to connect an offset point symbol to its original position in QGIS?

Short story written from alien perspective with this line: "It's too bright to look at, so they don't"

Applicants clearly not having the skills they advertise

Personalization conditions switching doesn`t work in Experience Editor (9.1.0, Initial Release)

What happened to all the nuclear material being smuggled after the fall of the USSR?

Does resistor placement change power dissipation in simple LED circuit?

Why does a helium balloon rise?

Will TSA allow me to carry a Continuous Positive Airway Pressure (CPAP) device?

Can we use the verb "says" for advertisement?

Is there any word or phrase for negative bearing?

How bad would a partial hash leak be, realistically?

How were concentration and extermination camp guards recruited?

Working in the USA for living expenses only; allowed on VWP?

X-shaped crossword



Firebase: Get current time without writing to the database (IOS and ANDROID)


Get Firestore Server Time and convert to DateTime without set/update data?How to save the current date/time when I add new value to Firebase Realtime DatabaseShip an application with a databaseHow can I connect to Android with ADB over TCP?“Conversion to Dalvik format failed with error 1” on external JARDownload a file with Android, and showing the progress in a ProgressDialogWhat is the simplest and most robust way to get the user's current location on Android?Get current time and date on Android“cannot resolve symbol R” in Android StudioHow can I send a Firebase Cloud Messaging notification without use the Firebase Console?What's the difference between Cloud Firestore and the Firebase Realtime Database?Android : Get current date and time from firebase






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I want to use Firebase to get the current time on server without writing to the database and then reading it.



Any one knows a solution to directly get a current time stamp from Firebase?










share|improve this question






























    0















    I want to use Firebase to get the current time on server without writing to the database and then reading it.



    Any one knows a solution to directly get a current time stamp from Firebase?










    share|improve this question


























      0












      0








      0


      1






      I want to use Firebase to get the current time on server without writing to the database and then reading it.



      Any one knows a solution to directly get a current time stamp from Firebase?










      share|improve this question
















      I want to use Firebase to get the current time on server without writing to the database and then reading it.



      Any one knows a solution to directly get a current time stamp from Firebase?







      android ios firebase firebase-realtime-database timestamp






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 26 '18 at 13:39









      Alex Mamo

      50.4k83169




      50.4k83169










      asked Jul 26 '18 at 13:24









      datadata

      1567




      1567






















          2 Answers
          2






          active

          oldest

          votes


















          3














          Yes there is! It doesn't matter if it is for IOS or for Android, you can write a frunction in Cloud Functions for Firebase which will be as easy as:



          exports.currentTime = functions.https.onRequest((req, res) => 
          res.send("timestamp":new Date().getTime())
          )


          You can host this in Cloud Function and get the server timestamp without user interaction.



          For more informations on how to set/read a timestamp in a Firebase Real-time database, please see my answer from this post.






          share|improve this answer























          • Thanks for your answer, but how to get this value from the client (lets say for android)?

            – data
            Jul 26 '18 at 17:17











          • In the exact same way I have explained in this post, right? Use the getTimeDate() method and that's it.

            – Alex Mamo
            Jul 26 '18 at 17:20











          • I mean when I deploy my function, how would this function give me the time?

            – data
            Jul 26 '18 at 17:23











          • How is this function triggered and how would it return the current time to my app?

            – data
            Jul 26 '18 at 17:25












          • You need to host in Coud Function and then trigger like any other function. Use cron-job.org for example, right?

            – Alex Mamo
            Jul 26 '18 at 17:34



















          1














          You have to write a firebase cloud function that calculates the time. Deploy that function on firebase. Whenever you request that function it will gives you the current time.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51539997%2ffirebase-get-current-time-without-writing-to-the-database-ios-and-android%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            Yes there is! It doesn't matter if it is for IOS or for Android, you can write a frunction in Cloud Functions for Firebase which will be as easy as:



            exports.currentTime = functions.https.onRequest((req, res) => 
            res.send("timestamp":new Date().getTime())
            )


            You can host this in Cloud Function and get the server timestamp without user interaction.



            For more informations on how to set/read a timestamp in a Firebase Real-time database, please see my answer from this post.






            share|improve this answer























            • Thanks for your answer, but how to get this value from the client (lets say for android)?

              – data
              Jul 26 '18 at 17:17











            • In the exact same way I have explained in this post, right? Use the getTimeDate() method and that's it.

              – Alex Mamo
              Jul 26 '18 at 17:20











            • I mean when I deploy my function, how would this function give me the time?

              – data
              Jul 26 '18 at 17:23











            • How is this function triggered and how would it return the current time to my app?

              – data
              Jul 26 '18 at 17:25












            • You need to host in Coud Function and then trigger like any other function. Use cron-job.org for example, right?

              – Alex Mamo
              Jul 26 '18 at 17:34
















            3














            Yes there is! It doesn't matter if it is for IOS or for Android, you can write a frunction in Cloud Functions for Firebase which will be as easy as:



            exports.currentTime = functions.https.onRequest((req, res) => 
            res.send("timestamp":new Date().getTime())
            )


            You can host this in Cloud Function and get the server timestamp without user interaction.



            For more informations on how to set/read a timestamp in a Firebase Real-time database, please see my answer from this post.






            share|improve this answer























            • Thanks for your answer, but how to get this value from the client (lets say for android)?

              – data
              Jul 26 '18 at 17:17











            • In the exact same way I have explained in this post, right? Use the getTimeDate() method and that's it.

              – Alex Mamo
              Jul 26 '18 at 17:20











            • I mean when I deploy my function, how would this function give me the time?

              – data
              Jul 26 '18 at 17:23











            • How is this function triggered and how would it return the current time to my app?

              – data
              Jul 26 '18 at 17:25












            • You need to host in Coud Function and then trigger like any other function. Use cron-job.org for example, right?

              – Alex Mamo
              Jul 26 '18 at 17:34














            3












            3








            3







            Yes there is! It doesn't matter if it is for IOS or for Android, you can write a frunction in Cloud Functions for Firebase which will be as easy as:



            exports.currentTime = functions.https.onRequest((req, res) => 
            res.send("timestamp":new Date().getTime())
            )


            You can host this in Cloud Function and get the server timestamp without user interaction.



            For more informations on how to set/read a timestamp in a Firebase Real-time database, please see my answer from this post.






            share|improve this answer













            Yes there is! It doesn't matter if it is for IOS or for Android, you can write a frunction in Cloud Functions for Firebase which will be as easy as:



            exports.currentTime = functions.https.onRequest((req, res) => 
            res.send("timestamp":new Date().getTime())
            )


            You can host this in Cloud Function and get the server timestamp without user interaction.



            For more informations on how to set/read a timestamp in a Firebase Real-time database, please see my answer from this post.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 26 '18 at 13:36









            Alex MamoAlex Mamo

            50.4k83169




            50.4k83169












            • Thanks for your answer, but how to get this value from the client (lets say for android)?

              – data
              Jul 26 '18 at 17:17











            • In the exact same way I have explained in this post, right? Use the getTimeDate() method and that's it.

              – Alex Mamo
              Jul 26 '18 at 17:20











            • I mean when I deploy my function, how would this function give me the time?

              – data
              Jul 26 '18 at 17:23











            • How is this function triggered and how would it return the current time to my app?

              – data
              Jul 26 '18 at 17:25












            • You need to host in Coud Function and then trigger like any other function. Use cron-job.org for example, right?

              – Alex Mamo
              Jul 26 '18 at 17:34


















            • Thanks for your answer, but how to get this value from the client (lets say for android)?

              – data
              Jul 26 '18 at 17:17











            • In the exact same way I have explained in this post, right? Use the getTimeDate() method and that's it.

              – Alex Mamo
              Jul 26 '18 at 17:20











            • I mean when I deploy my function, how would this function give me the time?

              – data
              Jul 26 '18 at 17:23











            • How is this function triggered and how would it return the current time to my app?

              – data
              Jul 26 '18 at 17:25












            • You need to host in Coud Function and then trigger like any other function. Use cron-job.org for example, right?

              – Alex Mamo
              Jul 26 '18 at 17:34

















            Thanks for your answer, but how to get this value from the client (lets say for android)?

            – data
            Jul 26 '18 at 17:17





            Thanks for your answer, but how to get this value from the client (lets say for android)?

            – data
            Jul 26 '18 at 17:17













            In the exact same way I have explained in this post, right? Use the getTimeDate() method and that's it.

            – Alex Mamo
            Jul 26 '18 at 17:20





            In the exact same way I have explained in this post, right? Use the getTimeDate() method and that's it.

            – Alex Mamo
            Jul 26 '18 at 17:20













            I mean when I deploy my function, how would this function give me the time?

            – data
            Jul 26 '18 at 17:23





            I mean when I deploy my function, how would this function give me the time?

            – data
            Jul 26 '18 at 17:23













            How is this function triggered and how would it return the current time to my app?

            – data
            Jul 26 '18 at 17:25






            How is this function triggered and how would it return the current time to my app?

            – data
            Jul 26 '18 at 17:25














            You need to host in Coud Function and then trigger like any other function. Use cron-job.org for example, right?

            – Alex Mamo
            Jul 26 '18 at 17:34






            You need to host in Coud Function and then trigger like any other function. Use cron-job.org for example, right?

            – Alex Mamo
            Jul 26 '18 at 17:34














            1














            You have to write a firebase cloud function that calculates the time. Deploy that function on firebase. Whenever you request that function it will gives you the current time.






            share|improve this answer



























              1














              You have to write a firebase cloud function that calculates the time. Deploy that function on firebase. Whenever you request that function it will gives you the current time.






              share|improve this answer

























                1












                1








                1







                You have to write a firebase cloud function that calculates the time. Deploy that function on firebase. Whenever you request that function it will gives you the current time.






                share|improve this answer













                You have to write a firebase cloud function that calculates the time. Deploy that function on firebase. Whenever you request that function it will gives you the current time.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jul 26 '18 at 13:31









                RajRaj

                2,4912520




                2,4912520



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51539997%2ffirebase-get-current-time-without-writing-to-the-database-ios-and-android%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript