No internet connection
  1. Home
  2. How to

How to insert the current time into a variable

By Andrew Sherman @Andrew_Sherman
    2021-06-02 17:50:08.439Z

    How do I get the current time of day as a variable?

    Example it's 15:15:45pm and I want to have a variable that returns 151545.

    Solved in post #2, click to view
    • 3 replies
    1. Kitch Membery @Kitch2021-06-02 18:13:50.605Z

      Something like this should do it @Andrew_Sherman :-)

      let currentDateAndTime = new Date();
      
      let timeVariable = currentDateAndTime.toTimeString().split(' ')[0].split(':').join('');
      
      log(timeVariable);
      
      

      Rock on!

      ReplySolution
      1. AAndrew Sherman @Andrew_Sherman
          2021-06-02 18:34:52.909Z

          Thank you Kitch!

          1. Kitch Membery @Kitch2021-06-02 18:35:46.810Z

            My pleasure @Andrew_Sherman :-)