How to convert a date (Thu 31 Oct 2019 10:08:29) format to Milliseconds (1572516509000) in Load runner (Vugen) - performance-testing

During my scripting in Vugen (Web/HTTP-HTML), I have captured the time in date format (Thu 31 Oct 2019 10:08:29) in parameter file using date-time format (%a %d %b %Y %H:%M:%S). The value I have to pass in the Body section of web_custom_request, it accepts only milliseconds (1572516509000). How we can convert this date format to milliseconds in LR.
Can anyone suggest to me here?
Thanks,
Soumen

Help to understand the use case. Do you need to have the time in milliseconds at the time of submission? At some time in the past for a given date and time? At some point in the future for a given date and time?
The reason why I ask is that there are built in functions for generating a UNIX styled timestamp for the current time. You could potentially plus or minus some number of milliseconds off of this for dates in the past or future depending upon the nature of the request: 86,400,000 milliseconds in a day

Related

Azure Data Factory data flow timezone conversion problem

I was trying to convert a timezone from CST to UTC inside a data flow. A quick google gave me that CST is in UTC-6:00, so it should add 6 hours.
The following derived column function for some reason only added 5 hours:
toUTC(localDatetime, 'CST')
Moreover, CurrentUTC('CST') Gave me the correct 6 hours difference, so I had to rewrite this function like this:
LocalDatetime + hours(toInteger((currentUTC('CST') - currentUTC()) / 1000 / 60 / 60))
// Minus between timestamps gives difference in milliseconds
Is this intended behavior? I am worried that when the timezone "shifts" this code will break, so using toUTC would be the best solution, but for some reason it gives incorrect results now
toUTC() converts a datetime to UTC time zone based on the Daylight-Saving Time effectiveness.
When you are converting from CST to UCT, if your date falls when Daylight saving is effective, then it adds +5 to your date else adds +6 to your date.
Example:
Derived column expression: toUTC(toTimestamp(Date_UTC), 'CST')

I have to convert utc time to ist in excel

I have to convert utc time to ist time in my excel the the time format is 10:00:00 utc this has to converted in IST timing.
Please suggested
There are no inbuilt functions that identify/convert the timezones. We can extend the capabilities of Excel Time() function to solve this use case.
=A1+Time(5,30,0)
For IST, you will have to add 5 hours and 30 minutes. Similarly, you can convert to any timezone by adding/subtracting the time difference.
The three inputs given to the Time() are hours,minutes and seconds.
This function returns the timestamp in a serial number format. Excel will interpret this number and show the timestamp in a readable format.

Convert day, hour and minute to UTC - node.js

I will get time input from the user for scheduling a task. The options are as follows,
Day of the week, hour and minute (or)
Day of the month, hour and minute (or)
Month of the year, hour and minute (or)
User can be in any timezone. I have modeled my database table to store the user input as a configuration.
In my table I will calculate the next_run_at and populate it, so that poller can find the jobs to run based on it and execute.
To be timezone agnostic, my next_run_at should be in UTC.
Is there a way to convert the above mentioned configuration(Day, hour, minute) alone in UTC and store it?
TL;DR I know we can convert a date to specific timezone. Is there a way to convert the combination of just day, hour and minute alone to UTC?
Construct a date from the day, hours, and minutes you have. Convert it to UTC and get the day, hours, and months values back.
But I think there will be edge cases as to which month the day corresponds to.
23:00 28th Feb PST will be 06:00 1st Mar UTC;
23:00 28th Mar PST will be 06:00 29th Mar UTC
You asked:
Is there a way to convert the combination of just day, hour and minute alone to UTC?
No, there is not a general way to do that. You must have the full date and time, including year, month, day, hour and minute. Otherwise you cannot be certain if daylight saving time is in effect, or if the standard time has changed.
You will have to assume some of the data you don't have. For example, you could make an assumption that the data is relative to "now". Just understand you will get different results depending on when you run the code.
Of course, this doesn't apply if there's only a single fixed offset for the time zone in question, such as Arizona being fixed to UTC-7. Just you can't assume this in the general case of any time zone of the world.

How to convert Excel date/time to epoch

I Googled and found a formula that is supposed to convert from Excel date/time to epoch time. However, it's off (or I'm off) and I can't figure out what I'm doing wrong. I'm using http://www.epochconverter.com/ as my source of truth.
So the link I found says the formula is:
=(A1-25569)*86400
I think 25569 is the Excel value for DATEVALUE("1-1-1970") but for some reason my version of Excel says that's 24107 so I made some modifications and typed:
=((A2-DATEVALUE("1/1/1970"))*86400 - 8*3600 (for PST)
Now the number is a little more correct. However, it seems like I need to ADD 8*3600 instead of SUBTRACT.
Can someone explain to me why?
I thought PST is -8 from GMT.
For the sake of an answer:
Your Excel is using the 1904 date system.
IF your Excel times start off as ‘local’ don’t adjust for time zone. IF they start as GMT (a concept Excel does not have) then, because when a GMT clock ticks on to 16:00 a ‘local’ clock should tick on to 08:00, from Excel to ‘local’ means deducting 8 hours. Note that midnight 31/12/1969 is not the same instant GMT as PST.

Time changes when converting date into ISOString in nodejs

I've got a date string from my database which has this format:
Tue Nov 12 2013 18:14:46 GMT+0100 (CET)
I want to convert it into a ISOString and im currently doing that with:
var iso = new Date(val.text_date).toISOString();
However for some reason the output time is moved 1 hour backwards?
This is the output im getting:
2013-11-12T17:14:46.000Z
How can i avoid this?
Short answer: the time is converted into UTC, and your original time was displayed in UTC+1, hence the one hour difference.
The Date.toISOString() method converts the date into a string in the ISO 8601 format. Note that the returned date in your example ends by a Z: 2013-11-12T17:14:46.000Z. As per the Mozilla documentation and Wikipedia:
If the time is in UTC, add a Z directly after the time without a
space. Z is the zone designator for the zero UTC offset

Resources