Salesforce Formula creation - date

Please can somebody help me with the syntax of this formula in salesforce as highlighted below I want to complete a project:
**If close date is blank then (today - open date)
otherwise (close date - open date)**
I tried using the ISBLANK function : ISBLANK( Close_Date__c) TODAY() today - open date, Else TODAY() close date - open date)

Related

Google sheets "ctrl+;" enters tomorrows date?

I have been using the shortcut "Ctrl + ;" to enter todays date but all of the sudden it thinks the date is tomorrow? Where does google sheets get this date information and how can I correct it?
see spreadsheet settings:
.....

Date formatting in Google Sheets is not working according to the instructions

Yes, I know; this question has been asked thousands of times in hundreds of different places, but Google Sheets stubbornly refuses to let me convert a date such as "9/18/2004" to "2004-9-18". I select one or more cells whose date format is "dd/mm/yyyy", click on FORMAT, then NUMBER, then MORE FORMATS, then I select "More date and time formats", and then select the example "1930-08-05", and then nothing happens. Nothing changes. I need help with this. Here is a link to the problem column:
https://docs.google.com/spreadsheets/d/1gYdPcNO-Jq1SFUpdb88o7KKVqG5_ia9NpD_3T98CkEw/edit?usp=sharing
Thanks.
From Google:
Change locale and time zone
When you change the locale and time zone of a spreadsheet, it changes the spreadsheet’s default currency, date, and number formatting.
On your computer, open a spreadsheet in Google Sheets.
Click File and then Spreadsheet settings.
Under "General," click the "Locale" and "Time zone" menus to change your settings.
Click Save settings.
Changing the locale doesn’t change your language settings in Google Sheets. You can set the language in Google Account settings.
Worked for me :)
9/18/2004 is not a date. its text string. if you change it to 18/9/2004 then you have a valid date and you can apply your desired formatting
to quickly reformat it you may use:
=ARRAYFORMULA(TEXT(IF(ISNUMBER(A2:A*1), A2:A, DATE(
REGEXEXTRACT(A2:A, ".{4}$"),
REGEXEXTRACT(A2:A, "^\d+"),
REGEXEXTRACT(A2:A, "/(\d+)/"))), "yyyy-mm-dd"))
So this just worked for me:
Change settings as advised - but THEN:
Insert a new column
Copy all dates from the original column into the new on with "paste special" => "values only".
Then select all dates and format again as date. From there on I could sort according to date etc.

Automatically convert date text to correct date format using Google Sheets

I'm trying to convert date from "text" to correct format. It is logged to Google Spreadsheets and I'm unable to use it to plot graphs.
This is the text format: February 3, 2018, at 11:21 AM
Time is not relevant, all I need is the date converted: DD/MM/YYYY.
I found a similar question where Gary's Student answered with a formula that looks like this for a different format:
=DATEVALUE(SUBSTITUTE(A1,MID(A1,FIND(" ",A1)-2,2),""))
(link to that question)
How can I use above formula (or something similar) so that text is converted to date?
Thanks in advance.
The , at portion of the string is keeping Google Sheets from recognizing it as a datevalue. Just remove it with the substitute function and wrap in datevalue function like so: =DATEVALUE(SUBSTITUTE(A1,", at",""))
To format as DD/MM/YYYY just go to custom formatting and set it to look like the following:
=DATEVALUE(JOIN("/", LEFT(D5,2), {MID(D5,4,2), RIGHT(D5,4)}))
where D5 contains for example: 25.06.2019
which script converts to datevalue: 43641
Dateformat is as dd.MM.YYYY converted to dd/MM/YYYY and then converted to datevalue.
Google sheet's documentation helps:
DATEVALUE, JOIN, LEFT, MID, RIGHT
Datevalue is useful for organizing rows of data by date correctly.
Another solution is to create custom function.
Open tools → script editor in menu to open script editor in new tab
Click Untitled project in top left corner and rename
Open Resources → Libraries in top menu
Paste library key MHMchiX6c1bwSqGM1PZiW_PxhMjh3Sh48 and click Add to add the Moment library to your script
Choose Moment version 9 and click Save
Paste function
function parseDate(dateString, format){
return Moment.moment(dateString, format).toDate()
}
to Code.gs and save project Ctrl+S
Now you use your function in any cell in your sheet:
=parseDate(B2,"MMM D, YYYY, at HH:mm A")
more details about format:
https://momentjs.com/docs/#/parsing/string-formats/
You can also create function to display date in custom format:
function formatDate(date, format){
return Moment.moment(date).format(format)
}
Use it like this in cell
=formatDate(B5,"DD/MM/YYYY")
or
=formatDate(parseDate(B2,"MMM D, YYYY, at HH:mm A"),"DD/MM/YYYY")

Sugarcrm Editing in-line date field automatically date format is changing as yyyy-mm-dd .i need as mm/dd/yyyy

When Editing dates in in-line edit, it returns in the yyyy-mm-dd. i need it to display in mm/dd/yyyy format .How can i achive this functionality . Thank you.
I assume as you've not provided any code that you are asking about setting it through the GUI.
I've flagged this as not related to programming, as you can find this by clicking the image at the top right, and going to Profile.
Click Edit, Advanced tab, and locale settings.
From here, you can set the date format for your user.
var date = new Date('2010-10-11T00:00:00+05:30');
console.log((date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear());

Crystal Reports Parameter Input dialog box changing the date format

When I generate a report that expects two date parameters, I first see the dialog box titled 'Enter Values' and the dialog box contains two text boxes with its own date picker widget. However, once I pick a date and click 'OK', the date is formatted as 'dd/MM/yyyy'. Does anyone know if it is possible to configure the report in a way so that the date format matches Windows system locale short date format? Instead of just defaulting to dd/MM/yyyy?
Thanks!
The date format for the parameter can't be changed, at least as far as I know. If you want the date displayed in a different format, you can always create a formula:
"From : " & ToText(Minimum({?date}), "M-d-yy") &
" To :" & ToText(Maximum({?date}), "M-d-yy")
Or you can go into the File menu, click on Options and under the Fields tab, there is a button for Date. Click on that and you can choose the format under the Date tab. This is for CR 2008, so it may be slightly different for CR XI.
If You are trying to filter in your SQL on date range field then you can add castings on dates. Like
datarangeField between cast({?Start Date} as date format 'm-d-yy')
AND cast({?End Date} as date format 'm-d-yy')
Also, you are required to add these (Start Date and End Date) in your SQL Parameters during Adding the query.
For display you can use formulas and format field options.