When using CurrentTime in logic apps, it gives the full date/time value like 2020-06-14T20:16:49.0131751Z
How can I select the time only Like 20:16:49?
The reason: I want to use CurrentTime in a condition to do actions within certain time windows.
For example: if time current time is greater than 08:00:00 & less that 23:00:00 --> do action.
You can just use the formatDateTime() function in logic app to format your CurrentTime, please refer to my logic app below:
The first expression(utcNow) is:
utcNow()
The second expression(formatDateTime) is:
formatDateTime(variables('CurrentTime'), 'HH:mm:ss')
Hope it helps~
Make a call to an api that provides the time. For example: http://worldclockapi.com/
Related
I am fetching a datetime value from the back end and I use the following line of code to get the time apart from the date :
{moment(element.dateTime).format('h:mm:ss a')}
I just want to know how to adjust the time zone in the code above to be the same as my country's time zone. Is there a way to achieve this?
Thanks in advance.
Moment by default will parse the date to your local computer. https://momentjs.com/guides/#/parsing/local-utc-zone/
You can use the utcOffset method as below, it takes the GMT Offset value. Change '+05:30' to whatever value you want
{moment.utc(element.dateTime).utcOffset("+05:30").format('h:mm:ss a')}
Also, Moment by default parses the date to your local timezone.
You can also use moment-timezone for timezone purposes, it asks for timezone name instead of gmtOffset. If you wish to use format method of moment though, there are certain limitations to it.
Moment Timezone
I am using ui-bootstrap timepicker and the time on the scope variable is always one hour behind the time that is displayed on the picker. what is causing it and how can I get rid of it. I need to store the correct time not the time thats one hour behind.
For example when the time on time-picker is :
16 : 12
i get to see on console:
Time is: "2016-05-26T15:12:34.403Z"
I followed very basic code for the ui-bootstrap timepicker. Can anyone explain how can I store the correct time in my variable.
Thanks in Advance.
I want to use Digital watch in cakephp according to time zone I provide.
I'm able to show current time according to user timezone.
In details..
I'm working on a project. I have a table in database where I have seved users details like.
First Name
Last Name
Timezone
and other details.
I want to show the digital clock on user's profile according to timezone stored in the database.
Kindly help me how can I do that.
Thanks
You ned to use Javascript to display clock at page. You can use any of it, just goole and select clock you like. For example this from w3schools it will display clock in the user's current timezone.
If you still want to show clock in predefined timezone just set starting values from PHP instead this line from above example:
var today=new Date();
use something like
var today=new Date(<?=$current_timestamp_in_selected_timezone?>);
Use PHP function to build $current_timestamp_in_selected_timezone mktime() or date()
Note that you need to write javascript code inside your View to use such technic what isn't a good approach. In good application you need to write code of your JS clock in JS file, put it into app/webroot/js, include that file in layout or call inside controller and than pass variable from PHP. How to do that read here: How to pass variables and data from PHP to JavaScript?
I'm not quite sure how to set the timezone in angularjs for the date filter, which converts 1970-01-01 to 1969-12-31. I've seen this post, which explains the same problem in Java, but not sure how to approach it in AngularJs - any clues?
The JavaScript date is based on a time value that is milliseconds since midnight 01 January, 1970 UTC. A day holds 86,400,000 milliseconds. The JavaScript Date object range is -100,000,000 days to 100,000,000 days relative to 01 January, 1970 UTC.
source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
JavaScript Date type does not have timezone support* you need to use either ISO 8601 format or send timestamp in UTC.
You can also use a library like timezone-js or moment.js
The angular developer guide says this about timezones:
The Angular datetime filter uses the time zone settings of the browser. The same application will show different time information depending on the time zone settings of the computer that the application is running on. Neither JavaScript nor Angular currently supports displaying the date with a timezone specified by the developer.
You can make your own filter to use a specific timezone. Here is a simple one using moment.js to parse 19700101 with the GMT timezone:
app.filter('GMT', function() {
return function(input) {
return moment(input + ' +0000', "YYYYMMDD").format('MMM DD, YYYY');
};
});
Here is a demo: http://plnkr.co/l5zd9Z1tli2NLmgPTWhJ
Thanks everyone for participating.
After quite a bit of time trying to find an easy way to resolve the problem I've found the solution - by simply using Date and one of it's methods:
new Date(date).toISOString();
That does the job and is super short :)
I would like to set date to default time zone. At this moment my date looks like this: 2013-04-08T22:00:00 +02:00. I need to set my date to +00:00.
I tried to get the offset of my date and I received -120. Is it possible to set time offset? Are there maybe any better solutions?
Anybody an idea?
I'm using EXT JS.
JavaScript's Date object is bound to the time zone of the computer itself. There is no way to change the zone offset programmatically to an arbitrary value.
There is some work going on to add this functionality to the Moment.js library, but it is still in progress.
If you are just looking to get the time at UTC in ISO format, you can use .toISOString()
If you are speaking about code that is specific to the Ext.Date object from ExtJS, please edit your question and post some sample code so we can get a better idea of what you are talking about. Thanks.