Get Last modified date on Blob Storage - azure-blob-storage

I'm uploading a file into Azure Storage Explorer, the blob check every 12 hours for a file, if there is a file an email is sent. When an email is sent I need to get the time and date when the file is uploaded not when the email is sent. I use the List of Files LastModified and the output is like this 2021-09-22T15:15:55Z, I don't need the time in UTC. Is there any way to change convert the time using the List of Files LastModified?

The 'List of Files LastModified' gives the exact thing that you required while in order to change the utc to local/Any time zone that we required, we need to add a function 'convertFromUtc'.
For CST :
formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Central Standard Time'),'HH:mm:ss')
For IST:
formatDateTime(convertTimeZone(utcNow(), 'UTC', 'India Standard Time'),'HH:mm:ss')
else you can perform hardcoded operation such as to SubtractFromTime or AddToTime considering the timezone that we wanted.
Here is the flow of my logic app
REFERENCES :
Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

Related

Slack : Slack Web API Method :conversations. history method not working as expected when using Latest and oldest options

I am writing an slack app for reading the messages from private channel and writing to database.
I use method conversation.history for this purpose.
My approach is
Call the Slack api with parameters limit=100,channelId ,bot token and
store the messages in database along with the timestamp ts for
message
Fetch next 100 by calling method with prams as
limit=100,channelid,bot token,oldest= ts (timestamp of oldest record inserted
in database
By the API documentation it says latest is default to value now .
In this case I should get next 100 records but I am getting nothing .
And I don't know how usually convert a date time like 12 Dec 2020
5:40:00 (12/03/2020) to timestamp like 1607017252.113300
I am using C# language for doing this whole work.
You should be passing the oldest timestamp as the latest parameter in the next API call. (The Slack API would benefit from renaming "latest" to "newest".)
First call:
https://slack.com/api/conversations.history?token=TOKEN&channel=CHANNEL_ID&limit=100
Second call:
https://slack.com/api/conversations.history?token=TOKEN&channel=CHANNEL_ID&limit=100&latest=PREVIOUS_OLDEST_TS

YouTube Live Streaming API Snippet.scheduledStartTime not Working while Creating Live Broadcast

I am creating YouTube live broadcast using API explorer everything is working fine but Snippet.scheduledStartTime is not working fine.
My time zone is +05:00 and country is Pakistan.
I want to schedule event at 2019-01-18 04:50 PM. I have set the Snippet.scheduledStartTime to 2019-01-18T11:50:00.000Z but on event page it shows Starts January 18, 2019 at 3:50 AM (PST) when I click edit it shows wrong country and time zone like that United States (GMT -08:00) Pacific
I want to use javascript or php client libraries.
Please let me know how I can fix it?
Here is my php code
$broadcastSnippet = new Google_Service_YouTube_LiveBroadcastSnippet();
$broadcastSnippet->setTitle('New Test Broadcast');
$broadcastSnippet->setScheduledStartTime('2019-01-18T11:50:00.000Z');
According to the YouTube Live Streaming API Docs, the format for scheduledStartTime must be in ISO 8601 format:
datetime
The date and time that the broadcast is scheduled to start.
The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
I would suggest that you check the time zone designator you have set.
Create date with timezone
I am not a PHP dev but the smartest thing to do IMO would be to create a date in the correct timezone and then out put it in the correct format. After about five minutes of googleing i found this.
$tz = 'Europe/London';
$timestamp = time();
$dt = new DateTime("now", new DateTimeZone($tz)); //first argument "must" be a string
$dt->setTimestamp($timestamp); //adjust the object to correct timestamp
echo $dt->format('c');

How to get latest updated record from sys_user table which is modified at or after certain time stamp in ServiceNow

I want to fetch record from the sys_user table which is updated at or after certain time stamp.
for that I have created rest request as
https:/service-now.com/api/now/v1//table/sys_user?sysparm_query=sys_updated_on>=javascript:gs.dateGenerate('2017-10-30','01:25:00')
I had converted current time which is in IST format into GMT and pass it to dateGenerate() function.
Problem statement -
I don't want to convert the IST to GMT, is there any way by which i can identify ServiceNow instance time zone at runtime and convert given time into that time stamp and get the users.
If i can pass this date and time in UTC format.
Ahoy!
This is a great question, and something that's quite difficult in ServiceNow (dealing with time-zones).
As such, I've written a tool to manage this for you. It's totally free!
The tool is called TimeZoneUtil, and can be found here:
https://snprotips.com/blog/2017/9/12/handling-timezones-in-servicenow-timezoneutil
You simply need to initialize a GlideDateTime object, set its' time-zone to IST, use setDisplayValue() to set its' time based on IST current time, then use .getValue() to get that same time in system time.
This is because getDisplayValue()/setDisplayValue() work based on time-zone, whereas setValue()/getValue() always return the corresponding system time.
EDIT: In order to make this a little more clear, I'll provide some example usage below.
var tz = new TimeZoneUtils(); //initialize with current time
gs.print(tz.getOffsetHours()); //prints out "-7" in my instance, as the system time is in Pacific.
tz.setTimeZone('Asia/Kolkata'); //sets the time-zone to IST/UTC+5.5
gs.print(tz.getOffsetHours()); //prints "5.5".
gs.print(tz.getGDT().getDisplayValue()); //Prints the current time in IST (2017-11-01 20:52:31 at the moment).
gs.print(tz.getGDT().getValue()); //Prints the current time in system time (2017-11-01 15:23:12 at present).
gs.print(new TimeZoneUtils().setTimeZone('Asia/Kolkata').getDisplayValue()); //Single line, also prints current time in IST: 2017-11-01 20:52:31
The first 6 lines there, demonstrate basic usage and explain how it works.
The eighth line however, demonstrates usage on a single line, which you can use inside a query string. For example:
sysparm_query=sys_updated_on>=javascript:new TimeZoneUtils().setTimeZone('Asia/Kolkata').getDisplayValue()
Hope this helps!
Tim Woodruff
Author, Learning ServiceNow & Building Powerful Workflows
Owner/Founder, SN Pro Tips

using ruby to correct timezone based on Day Light Savings Time [duplicate]

How do you convert a timezone from int to string (etc: Europe/Stockholm)?
I'm using Facebooks PHP api and that returns ["timezone"] => int(2). How am I suppose to parse that?
How do you convert a timezone from int to string (etc: Europe/Stockholm)?
You can't. Read "Time Zone != Offset" in the timezone tag wiki.
Facebook's documentation explains that the timezone field is the user's timezone offset from UTC.
What it doesn't make clear, but I have found through experimentation, is that it is not necessarily the user's current offset, but it instead it is the offset as of the user's last log in. If the user changes time zones, or daylight saving time begins or ends, that will not be reflected in the Facebook data until the user's next log in.
See also these posts:
Facebook API, timezone and country
FaceBook Time zone and Event Times
You can get the timezone name by using timezone_name_from_abbr("", $value*3600, false);. $value is the timezone offset you get from Facebook.
Thanks to minaz.

Why Google Calendar API V3 didn't accept all timezone IDs?

We are adding event with start time and end time like below snippet,
EventDateTime startEventDateTime = new EventDateTime().setDateTime(startDateTime).setTimeZone(timeZone);
EventDateTime endEventDateTime = new EventDateTime().setDateTime(endDateTime).setTimeZone(timeZone);
If the timeZone is either "Asia/Calcutta" or "GMT +05:30", it will be added in Google Calendar successfully, but some of our users' timezone is like "IST","PST","CST". If we give it in timeZone variable, Google Calendar throws
"Invalid time zone definition for start time."
Is it possible to accept even if the timezone is like "IST","PST","CST","EST"?
Time Zone should be in same format as shown in Google Calendar time Zone link.
For compatibility with JDK 1.1.x, some other three-letter time zone IDs (such as "PST", "CTT", "AST") are also supported. However, their use is deprecated because the same abbreviation is often used for multiple time zones (for example, "CST" could be U.S. "Central Standard Time" and "China Standard Time"), and the Java platform can then only recognize one of them. So just because of this Google might not accept the Three-letter time zone IDs.

Resources