I have the following JSON data:
2015-02-22T04:00:00-05:00 which clearly shows 4am to 5am which is a one hour slot, but in the week agenda view in fullcalendar it is showing as 4am to 6am, as are all 1 hour slots. any ideas why this is happening?
Use the latest version (2.2.6) of the fullcalendar. For some reason this version works fine.
Please refer to this example: Click Here
And here's a sample code that works properly and might help you as well:
var events_array = [
{
title: 'Test1',
start: moment('2015-02-03T05:00:00'),
end : moment('2015-02-03T12'),
tip: 'Test1'},
];
...
$('#calendar').fullCalendar({
events: events_array,
timezone : 'local',
eventRender: function(event, element) {
element.attr('title', event.tip);
}
});
Mikesmithdev answered this one for me, I didn't have an end specified, I thought you could do it with just one string of data.
Related
I'm trying to select current date from the calendar on this website "www.makemytrip.com".
Using these 2 lines of code:
driver.findElement(By.xpath("//label[#for='departure']")).click();
To open the calendar and to select date:
driver.findElement(By.cssSelector(".DayPicker-Day.DayPicker-Day--selected.DayPicker-Day--today")).click();
The first one is working fine as it opens up the calendar but cssSelector is not responding. I've tried various variations but still it remains unresponsive.
Try this xpath strategy:
//div[#class='DayPicker-Day DayPicker-Day--today']
Now, i write in python, so you may translate my code to Java, since most of it remains same.
time.sleep (Thread.sleep in Java) here is optional Ideally you should use WebdriverWait instead of Thread.sleep. But just to show you, I used it.
driver.get('https://www.makemytrip.com/')
time.sleep(3)
driver.find_element(By.XPATH, "//label[#for='departure']").click()
time.sleep(1)
dx = driver.find_element(By.XPATH, "//div[#class='DayPicker-Day DayPicker-Day--today']")
print(dx.text)
dx.click()
Here is the output:
17 is the date and the other value is currency.
17
₹ 9,418
Process finished with exit code 0
This question already has answers here:
How to use an Internet time server to get the time?
(5 answers)
Closed 1 year ago.
I have variable curTime, I want to get the current time of the form 1616572689, there are 2 familiar methods
val curTime: Long = Date().getTime()
or
val curTime = System.currentTimeMillis()
But here's the problem, if I change the time on the phone for example to 2007, then the value of the variable will be incorrect! It will show the year 2007. How do I make sure that the data is taken not from the system, but from the Internet? some site, for example https://timestamp.online/
Please help, couldn't find anything about this problem.
You find an online server with a public API for retrieving the current time, e.g. World Time API. That's just an example, there are other servers, and you should do your own research to find which server best fits your needs and licensing restrictions.
You then perform an HTTP GET request and parse the returned JSON to get the value you seek.
E.g. if you want the current time for US Eastern time zone, you do and HTTP GET from http://worldtimeapi.org/api/timezone/America/New_York, which will respond with something like this:
{
"abbreviation": "EDT",
"client_ip": "73.106.239.191",
"datetime": "2021-03-28T06:37:10.320418-04:00",
"day_of_week": 0,
"day_of_year": 87,
"dst": true,
"dst_from": "2021-03-14T07:00:00+00:00",
"dst_offset": 3600,
"dst_until": "2021-11-07T06:00:00+00:00",
"raw_offset": -18000,
"timezone": "America/New_York",
"unixtime": 1616927830,
"utc_datetime": "2021-03-28T10:37:10.320418+00:00",
"utc_offset": "-04:00",
"week_number": 12
}
The value you're looking for is the unixtime field.
in the test I have to get the product version and build number but they are in different lines, and have an extra suffix that needs to be removed.
I can not cope with this task, can you help?
JsonObject versionConfig = read("config","version",user.userName, user.password);
version=versionConfig.get("buildNumber").getAsString();
json answer
{
"version": "1.1-SNAPSHOT",
"branch": "1111",
"buildNumber": "666",
"date": "01.01.2020"
}
everyone understands what I am getting only version=666
but in the end I need to get
version=1.1.666
do not swear, I worked as a system administrator for 3 years, and I'm only learning Java, and with parsing, Json did not work at all, this is the best that I could
You can get your version and replace "Version" by your buildNumber:
String version = versionConfig.get("version").getAsString();
String buildNumber = versionConfig.get("buildNumber").getAsString();
String result = version.replace("Version",buildNumber);
//1.1-Version => 1.1-666
I am calling a service that returns data from a DB in the form of a LinkedList. I need to update the LinkedList with a new field called "status" which is determined off of endDate.
endDate > current date => status=deactivated
endDate <= current date => status=active
Mule Payload Class: java.util.LinkedList
Mule Payload: [{serialNumber=, maintenanceId=12345, customerID=09890, startDate=2017-10-10 23:34:17, endDate=2018-10-10 23:34:17},{serialNumber=, maintenanceId=09091, customerID=74743, startDate=2014-8-16 23:34:17, endDate=2019-8-16 23:34:17}]
The issue I am having in mule is that I am unable to navigate into the linked list to retrieve the value as well as add a new value to the list. Hoping someone could give me some advice on the best way to move forward. I am trying to use a groovy transformer to update the payload, but it's not going so well, so I don't have any code to show.
Thanks taking the time!
I had a similar requirement (the payload was a JSON but it should work as well) and this is what I did using Dataweave (I added your data so it can be easier to understand).
%dw 1.0
%output application/java
---
flowVars.input2 map {
serialNumber : $.serialNumber,
maintenanceId: $.maintenanceId,
customerID: $.customerID,
startDate: $.startDate,
endDate: $.endDate,
status: "deactivated" when $.endDate as :date {format:"yyyy-M-dd HH:mm:ss"} > (now as :date {format:"yyyy-M-dd HH:mm:ss"}) otherwise "activated"
}
With this transformation you iterate the list and add the status value based on your requirement.
Input example:
[{"serialNumber":"test1", "maintenanceId":"12345", "customerID":"09890", "startDate":"2017-10-10 23:34:17", "endDate":"2018-10-10 23:34:17"},{"serialNumber":"test2", "maintenanceId":"09091", "customerID":"74743", "startDate":"2014-8-15 23:34:17", "endDate":"2018-8-15 23:34:17"}]
Output example
[{"serialNumber":"test1","maintenanceId":"12345","customerID":"09890","startDate":"2017-10-10 23:34:17","endDate":"2018-10-10 23:34:17","status":"deactivated"},{"serialNumber":"test2","maintenanceId":"09091","customerID":"74743","startDate":"2014-8-15 23:34:17","endDate":"2018-8-15 23:34:17","status":"activated"}]
Hope this helps you
My php code :
echo time();
-----> 1427313418
My java (android) code :
String current_in_sec = (System.currentTimeMillis()/1000)+""; // to convert it to seconds.
Log.i("Log",current_in_sec);
----> 1427306783
Notice in php : 1427313783 , vs java 1427306418
I know that php returns time in seconds , while java returns time in millies , so I devided Java result by 1000 .
As you can see , the differences is not about milli seconds , it seems they are very different ( about 2 hours maybe );
And in php I used this :
date_default_timezone_set('UTC');
But it doesn't make any difference ;
Any guess ?
Hint :
I tried not to divide Java result by 1000 , here is the result :
String current_in_sec = (System.currentTimeMillis())+"";
Log.i("Log",current_in_sec);
----> 1427307978601
As you can see again 1427307978601 , The BOLD part is far different from php result;
This tests are in my Laptop:
myLaptop->Android studio->genymotion
myLaptop->(PHP+Apache)->SublimeText
Genymotion emulator is set to wrong timezone. Go to the Android settings, and set correct location/timezone. I had the same problem before.
Also, set it manually, not from internet.