I'm typing a date in a web billing application and it says that " Conversion from string "30/11/2022 00:00:00" to type 'Date' is not valid. " what should I do
image (https://i.stack.imgur.com/8McR3.png)
I'm trying to get month wise sale
Related
I want to change the deligatefromdate/deligatetodate in the person object in IBM's Maximo REST API.
If I want to set a date I use this request:
POST maximo/rest/mbo/person/12345/?_format=json&delegatefromdate=2020-12-02
My person object then is returned and the value in delegatefromdate is:
"DELEGATEFROMDATE": {
"content": "2020-12-02T00:00:00+01:00"
}
But now I want to remove the date, I dont want a delegatetodate/delegatefromdate.
I have tried:
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=
Value is not changed
POST maximo/rest/mbo/person/63006/?_format=json
Value is not changed
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=null
Error: Error 400: BMXAA4143E - The date format is not valid. Use the date format defined by your locale, or use the calendar control to enter a date.
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=NULL
Error: Error 400: BMXAA4143E - The date format is not valid. Use the date format defined by your locale, or use the calendar control to enter a date.
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=~null~
Error: Error 400: BMXAA4143E - The date format is not valid. Use the date format defined by your locale, or use the calendar control to enter a date.
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=~NULL~
Error: Error 400: BMXAA4143E - The date format is not valid. Use the date format defined by your locale, or use the calendar control to enter a date.
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=0
Date is set to: "2000-12-01T00:00:00+01:00"
I have tried with and without &addchange=
So my question is, how do I clear this date?
In the GUI I just erase the value and save and it is gone.
IBM has a record of this problem as APAR IV93341: UNABLE TO UPDATE FIELD TO NULL THROUGH THE MAXIMO REST API. Someone found it on Maximo 7.5.0.7, and the APAR fix was included in 7.6.0.8.
If you go here,
you'll find a list of the public profile data you can access from someone if they use Facebook to login to your site.
id
name
first_name
last_name
age_range
link
gender
locale
picture
timezone
updated_time
verified
But what datatypes do they come in? Without that information, it's tough to do anything with them.
UPDATE:
I tried capturing the data and getting their datatypes by calling the .class method on them. name yielded "String", but everything else yielded "NilClass".
UPDATE2:
To add to the confusion, name actually yields the email address associated with the Facebook account, not the name.
You can see user object. Fields coming from public_profile are of user object.
id - numeric string
name - string
first_name - string
last_name - string
age_range - age-range object
link - string
gender - string
locale - string
picture - string
timezone - float (min: -24) (max: 24)
updated_time - datetime
verified - bool
You can use string or long int for id. Because facebook id's are very long and unique for the app.
If you are using C# you can use a type of 'dynamic' which works concurrently with 'ExpandoObject'. Very powerful stuff for transforming data types that you are not really 'sure' about.
A sample of code to do so would be as such.
dynamic item = faceBookApi.Property;
var type = item.GetType();
.Net Framework 4.6.1
I have a field in my Parse object set as Date. The object also has automatically added fields createdAt, updatedAt.
The response from the REST API looks like this
{"results":[
{
"createdAt":"2015-07-22T08:50:29.890Z",
"updatedAt":"2015-07-22T08:50:29.890Z",
"startDate":{"__type":"Date","iso":"2015-08-04T14:00:00.000Z"}
}
]}
All three fields are of type Date. However, their representation varies and it breaks the serializer.
I also noticed that they behave differently in the data browser.
Is this by design or am I doing something wrong?
"startDate": {
"__type": "Date",
"iso": "2015-08-04T14:00:00.000Z"
}
The above format is ISO date format. Parse supports ISO and all JS date formats (like the other ones). While we send data to Parse, it expects the date to be in ISO format.
You can parse the ISO date into JS format like this:
var startDate = new Date(results.startDate.iso);
I'm making this kind of SoundCloud API request:
https://api.soundcloud.com/tracks.json?q=electro&limit=10&client_id=<my-client-id-that-I-removed-intentionally>&created_at%5Bfrom%5D=2014%2F11%2F24%2012%3A03%3A04&offset=0
and since recently, I'm getting this response:
code: 400,
body:
{"errors":[{"error_message":"invalid filter.created_at[from] value: '2014/11/24 12:03:04'"}]}
My request should be fine, according to the official documentation:
https://developers.soundcloud.com/docs/api/reference#tracks
Could you please tell me if I'm doing something wrong?
Thanks for the support in advance.
The problem is in the date format. The docs say dashes should be used in dates:
created_at[from] date (yyyy-mm-dd hh:mm:ss) return tracks created at this date or later
So it will work when you specify the date like this: 2014-11-24 12:03:04 (not with slashes).
We at SoundCloud recently changed the behaviour of the API to return errors for all kinds of for invalid input in filters in order to be clearer about what is allowed and what can be expected.
My Station is configured to EU Location format for date: dd/mm/yyyy
Everything is working fine expect when I send a date as a parameter via HTTP get:
http://localhost:6105/assignment?date=07/02/2011
This call is received by this code:
public ActionResult Index(DateTime? date = null)
{
}
as date = 2.7.2011
any other date reference in the site is working OK and as expected (dd/mm/yyyy).
How can I resolve this ?
I had the same issue as you and found the solution at this site: Localization of dates in asp.net. The issue is that MVC does not support localization of DateTimes in GET-requests, only in POST-requests. This is by design!
The blog post mentions some javascript-hacks to avoid this issue but I'd change to use culture-invariant dates.
I know it's been 2 years but I used this method :
I pass the parameter as a string and parse it to a DateTime in the backend code :
public ActionResult Index(string date = null)
{
DatetTime realDate;
DateTime.TryParse(date, out realDate)
}