How can i get only the date and time in selenium IDE - date

I'm using selenium IDE and i would like to capture only the date and time from a field that was updated
Example:
Updated by James in 07/05/2015 - 09:50
I need to get only this date and the time from the record updated
Is there a way to do this ?
Thanks

Well you can do it with storeEval(). You can use JavaScript to manipulate stored variables. Lets assume that you stored that whole text in variable updated
${updated} == "Updated by James in 07/05/2015 - 09:50"
Now we just need to get that variable and get part of its text:
Command: storeEval()
Target: storedVars['updated'].split(' ')[4]
Value: date
Basically we get updated and we split it into array using space as separator, and then we get 4th element of array, which contains date and store in it new variable date.
Now:
${date} == "07/05/2015"
The same you can do with time.

Related

Google Sheets - DATE format not working on imported Date in TEXT format

I text based .csv file with a semicolon separated data set which contains date values that look like this
22.07.2020
22.07.2020
17.07.2020
09.07.2020
30.06.2020
When I go to Format>number> I see the Google sheets has automatic set.
In this state I cannot use and formulas with this data.
I go to Format>number> and set this to date but formulas still do not see the actual date value and continue to display an error
Can someone share how I can quickly activate the values of this array so formulas will work against them?
I would be super thankful
Where the date are in column A, starting in cell A1, this formula will convert to DATE as a number, after which you apply formatting to Short Date style.
=ARRAYFORMULA(IF(A1:A="",,DATE(RIGHT(A1:A,4),MID(A1:A,4,2),LEFT(A1:A,2))))
Hopefully(!) the dates stay as text, otherwise Google Sheets would sometimes detect MM/dd/yyyy instead of dd/MM/yyyy, and you won't be able to distinguish between July 9th and September 7th in your example.
Solution #1
If your locale is for instance FR, you can then apply
=arrayformula(if(A1:A="";;value(A1:A)))
solution#2
you can try/adapt
function importCsvFromIdv1() {
var id = 'the id of the csv file';
var csv = DriveApp.getFileById(id).getBlob().getDataAsString();
var csvData = Utilities.parseCsv(csv);
csvData.forEach(function(row){
date = row[0]
row[0] = date.substring(6,10)+'-'+date.substring(3,5)+'-'+date.substring(0,2)
})
var f = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
f.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData);
}
First thanks to those that suggested a fix. I am not really a programmer and get cold sweats when I see suggesting of running scripts to solve simple problems. Sorry guys.
So the (non programmer) solution with the dates was to do a find/replace (CTRL + H) and replace all the (.)dots with (/)slashes, then to make sure the column is formatted as a date, then Google finally understands it as a date.
With the accounting values as well, I had to do the same find/replace to remove all the ' between thousands, then google woke up and understood them as numbers.
I am significantly underwhelmed by this from Google. They are getting too fat and lazy. They need some competition.

How to get the current year from freemarker template

I have use the ${.now} to get the current time stamp inside the freemarker templates, but I want to know how can I get only the year?
Like ${.now?string('yyyy')}. (Note that this will return a string, which is what you want if you only want to print it. If by any chance you need a number, so that you can do arithmetic with it, then it's .now?string('yyyy')?number.)

Export Calendar Date to spreadsheetout - Time Stripped off - Google Script

I am using Google Script to export some calendar events to a spreadsheet; the relevant portion of my script is below:
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), events[i].getStartTime(), myformula_placeholder, ('')]];
var range=sheet.getRange(row,1,1,7);
range.setValues(details);
This code works but the "time" that is put into the spreadsheet is a real number of the form nnnnn.nn. On the spreadsheet itself the date looks great using the integer to the left of the decimal (eg 10/15/2017) but the decimals are part of the value and therefore are part of the spreadsheet value.
My script drops the data into a sheet in my workbook, and another sheet reads the rows of data with the above date types, looking for specific date info from the other sheet using the match function (for today()). That would work fine if I could get rid of the decimals.
How can I use what I have above (if I stray far from what I have found works I will be redoing hours of work) but adding just what is needed to only put into the output spreadsheet the whole number portion so I have a pure date that will be found nicely by my match function using today()?
I have been digging, but errors abound in trying to put it all together. "Parse" looked like a good hope, but it failed as the validation did not like parse used within getStartTime. Maybe I used it in the wrong manner.
Help would be appreciated greatly.
According to the CalendarApp documentation, getStartTime() generates a Date object. You should be able to extract the date and time separately from the date object:
var eventStart = events[i].getStartTime(); // Returns date object
var startDate = eventStart.toDateString(); // Returns date portion as a string
var startTime = eventStart.toTimeString(); // Returns time portion as a string
You could then write one or both of these to your spreadsheet. See the w3schools Javascript Date Reference for more information:
http://www.w3schools.com/jsref/jsref_obj_date.asp
If you If you want to specify the string format, you can try formatDate in the Utilities service:
https://developers.google.com/apps-script/reference/utilities/utilities#formatdatedate-timezone-format
You could just use the Math.floor() function
http://www.w3schools.com/jsref/jsref_floor.asp
which will round the real number to an integer. Your line would then read:
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), Math.floor(events[i].getStartTime()), myformula_placeholder, ('')]];

How can I compare and check date of program and the system date in MVS 2012 Coded UI test?

I am trying to compare and check the date if it is today's date or not in a spesific program. I tried to use assertion method but when I use it the time will remain same if you try it next day. The main problem that I need to know when open a page from program It should be today's date and should be passed. if you know already anything about it please let me know also :)
Thanks yo!
Use System.DateTime.Now.ToString("yyyy-MM-dd") as one argument of the assertion. You may need to use a different format rather in the ...ToString() method. The exact format depends on how the date is shown on the screen.
This could be done using "StringAssert" to verify that your programs date string contains today's date string, while ignoring the time:
var programDateString = "7/25/2016 12:00:00"; //this is an example of your date retrieved from the application with time included
var todaysDate = System.DateTime.Today.ToShortDateString(); //short date string
StringAssert.Contains(programDateString, todaysDate);

Joomla 3.4.5 Form Field Calendar shows 1970-01-01 instead of empty

I'm stucking with this issue:
I use in fomrs the calendar form field, MySQL database field for this is set to DATE and defaults to 0000-00-00
Form field definition in xml uses
format="%Y-%m-%d"
default="0000-00-00"
On the frontend always appears 1970-01-01 instead of an empty field.
I searched the net but can't found a solution how to get an empty field if there is the zero in database. Can anyoune help me out?
The field for storing this date didn't allow for NULL values, and therefor used 0000-00-00 as default (it's a date field). Thus I decided to see what happened when I changed the field in the database to allow for NULL values and set the value for the specific record to NULL. Et voila... Problem solved. No more "strange date" display.
However... When saving the date-field, Joomla decided that it should be stored as 0000-00-00, making the display bogus again. Therefor I had a look at the model and added the line:
if ($data->birth_date == '0000-00-00') { $data->birth_date = ''; }
Before returning $data in protected function loadFormData().
Now to finish it off, since the listing still displayed "0000-00-00" I had a look at that model for the listing and added
$oneItem->birth_date = ($oneItem->birth_date == '0000-00-00') ? "" : $oneItem->birth_date;
before it returned the $items in public function getItems().
You have set the default to: 0000-00-00.
This is a time way before computers were invented, php defaults back to the below if the date is invalid or invalid
1970-01-01
Therefore it will default to that as its as far back as it can go.
Set an actual default date or set to NOW to load in current date.