What is the default format of date in salesforce? - salesforce

I am passing the date from a Salesforce web to lead form to Salesforce.I am passing the date in MM/DD/YY format but it is not getting saved in the Salesforce.
What may be the reason?
Please suggest.

For date only field pass the date in these date formats MM/dd/yyyy or yyyy-MM-dd. Check this thread for more information

Related

If a date field is empty then how can I compare the date from another field

I have form where a user puts in a date but I want to stop the user from inputting a date which is more than the date on the main form if the date is mentioned and the date shoud also be less than the date already on the same form which is the Date From field.
I came up with this valdidation criteria
>=[DateFrom] And IIf([Forms]![FrmPatientInfo]![EndOfTreatment] Is Null,<=Date(),<=[Forms]![FrmPatientInfo]![EndOfTreatment])
It is not letting me put any dates in the field.
Please tell me what I am doing wrong here.
Try with:
>=[DateFrom] And <=Nz([Forms]![FrmPatientInfo]![EndOfTreatment],Date())
or simply:
>=[DateFrom] And <=Nz([EndOfTreatment],Date())

SSRS Date Parameter Mismatching

I have an issue with SSRS where when posting in a DD/MM/YY value via URL string into a Parameter it decides to read the Day value as the Year, the Month as month, but the Year goes into Day value, for example:
I am inputting the date of 30/08/17 via an ERP System which then generates a string to be used as an URL to generate the report, this date value should then go into a parameter called fiAsOfDate which is Date/Time data type, but at this point it is reading the value as 08/17/1930 inside the Parameter list, even though the URL remains at 30/08/17.
This happens prior to the Query being processed, and the fiAsOfDate parameter then gets formatted through to to MMDDYYYY to be processed within the Query, but the issue is specifically when the parameter is having the value loaded from the URL into the parameter value, and I was hoping if anyone could assist me on this please?
I should also add, this original date is coming from an ERP system which will have regional based date formatting, as it is used internationally, so I cannot restrict myself to one input format, and it should be using regional settings, matching that of the Reporting server that it is based on.
Kind Regards,
James W. Acklam.
To avoid regional setting issues you can change the date into a known integer or string format: I use CONVERT(NVARCHAR, YourDate, 112) to get a string '20170830'. The regional settings won't recognize that as a date and so won't auto-parse it into MM/DD/YYYY or DD/MM/YYYY. Of course, you'll need to parse that yourself so you can use it in the report, but at least you know the format.
This issue was down to my own misunderstanding that the DataSource I was pulling data from worked only in DMY format. Converting dates from parameters format to DMY format and processing that through the DataSet's query resolved the issue.

In the crysral report I have to convert date in the date part format

In the crystals I have to convert the date into date Part as below format.
If date is 1) 23/09/2015 the convert in the format like Sept-2015
2) 21/3/2015- mar-2015
3) 19/2/2015 feb-2015
check it also possible in Sql server.
In Crystal Report Design, Right Click on date field->select Format field. Now you can see more date formats including your required format

AngularJS layered date filter for database submission

I am having trouble with date submissions to a database. When date and time are both needed, I parse the values from the database as a timestamp, which gives me the value of the date and time in milliseconds since 1970. Using the AngularJS date filter, I am able to display the value in a user-friendly way.
$filter('date')(1380292078000, 'MM/dd/yyyy hh:mm a'); => 09/27/2013 10:27 AM
But this format as a timestamp when I send the value back to the database, my code throws an error. The database wants the date to be displayed in a different format.
java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss
So I add a second filter to convert the value date representation of the millisecond count (the user might have changed the value), but I am just getting a clone of the first date representation.
$filter('date')('09/27/2013 10:27 AM', 'yyyy-mm-dd hh:mm:ss') => 09/27/2013 10:27 AM
Here is a link to the fiddle I wrote to test this. Are we not able to stack filter conversions on top of each other? I had a thought to convert the first conversion result into milliseconds to use as a source for the second conversion, but I didn't see a method to accomplish this in the date documentation. If that would be the only solution, though, I am sure I could whip something up. Because Java has mostly deprecated functions to work with dates, I feel it would be simpler to handle this on the Javascript/AngularJS side.
The date filter will only work with a JSON date string (see source).
You can get around your problem by converting to a date object:
$scope.date2 = $filter('date')(new Date($scope.date), 'yyyy-MM-dd hh:mm:ss')
See updated fiddle
However... You should be validating and formatting this input on the server side. You can't trust data coming from a javascript application to be in the correct or expected format. I'd recommend just posting back $scope.date and allowing the server to format in your database format. By doing the yyyy-MM-dd hh:mm:ss formatting on the client-side, you're tightly coupling your user interface to database implementation and that's generally considered a bad idea.

How to display a UK date on a HTML Form, then save it in a standard format to the database

I'm building a web app and the customer has requested that any date field that must have data entered in to it be in the UK format (DD/MM/YYYY). Currently, I have it so that all the date fields must have a date entered in the YYYY/MM/DD format because this is what the database uses.
How can I let a user enter a date in the UK format, but then flip it around to then save it correctly to the database?
In beforeSave callback check if a date field is provided and if so, use DateTime::createFromFormat to create a DateTime object from your display format. And then change it to sql format via DateTime::format()
if (isset($this->data[$this->alias]['date_field'])) {
$this->data[$this->alias]['date_field'] = DateTime::createFromFormat('d/m/Y', $this->data[$this->alias]['date_field'])->format('Y/m/d');
}

Resources