cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Give current date and time values in value 2Dwidget

Burubae
8-Gravel

Give current date and time values in value 2Dwidget

hi community, thanks for your help.

how can i give a current date and time values in a value 2D widget, or any other 2Dwidget??

please, i need yor help.

 

ACCEPTED SOLUTION

Accepted Solutions

Hi @Burubae ,  @

 

there are  a lot of ways to implement this, but the most of them are based on the JavaScipt now() functionality (Date(Date.now())

e.g. to print in the console the complete data is something like :

 

console.info("started $ionicView.afterEnter  at time: "+Date(Date.now()))
// or direct assign to a lable
$scope.view.wdg['label-2'].text= "Current data&time: "+Date(Date.now()));

 

so it will print e.g. to the console:

started $ionicView.afterEnter  at time: Tue Feb 04 2020 11:30:08 GMT+0100 (Central European Standard Time)

 

 One further important question is how to extract the correct data / e.g. the time or only the date or only the day ... etc. where are different methods which are supported by the Date object but all of this you can find in programming forums for javascript general programming e.g.

JavaScript Get Date Methods”,

Getting current date and time in JavaScript

 “https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime

Or https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Date/now

etc... 

View solution in original post

2 REPLIES 2

Hi @Burubae ,  @

 

there are  a lot of ways to implement this, but the most of them are based on the JavaScipt now() functionality (Date(Date.now())

e.g. to print in the console the complete data is something like :

 

console.info("started $ionicView.afterEnter  at time: "+Date(Date.now()))
// or direct assign to a lable
$scope.view.wdg['label-2'].text= "Current data&time: "+Date(Date.now()));

 

so it will print e.g. to the console:

started $ionicView.afterEnter  at time: Tue Feb 04 2020 11:30:08 GMT+0100 (Central European Standard Time)

 

 One further important question is how to extract the correct data / e.g. the time or only the date or only the day ... etc. where are different methods which are supported by the Date object but all of this you can find in programming forums for javascript general programming e.g.

JavaScript Get Date Methods”,

Getting current date and time in JavaScript

 “https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime

Or https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Date/now

etc... 

thank you so much for your help!!!✌️💚👨‍💻💪

Announcements

Top Tags