Acumatica Report Writer extract date from date time field - acumatica

In Acumatica advanced report writer i have a date parameter but when i print this it shows in DD/MM/YYYY HH:MM:SS format. What is the format syntax so it only shows the date in DD/MM/YYYY format?
Thanks

Use the report designer format field:
Date format syntax is from .Net Framework:
custom date and time format strings
If you need a hardcoded format (with slashes) use 'dd/MM/yyyy'.
If you only want the short date format (date without time) use 'd'.
I would pick 'd' format if all you want is to remove time because it will follow the culture and still provide a short date.
Example: 'MM-dd-yyyy' or 'dd/MM/yyyy' etc...

Related

Update 'date' column using 'ValidateUpdateListItem' endpoint

I am trying to update SharePoint document's metadata using '/GetFileByServerRelativeUrl('/sites/sitename/doclib/doc.txt')/ListItemAllFields/ValidateUpdateListItem' endpoint within my (.netcore) webapi. This requires the date to be in specific format. The problem that I am facing is while I am able to successfully update the date column by transform date into "yyyy-MM-dd hh:mm tt", if I try the other format "MM/dd/yyyy hh:mm:ss" it throws an error:
Invalid Data '02/17/2022 12:29:03' for the field 'Modified', Error:
Enter a date and time like this: 2012-02-23 2:25 PM
The reason, I am trying the other format ("MM/dd/yyyy hh:mm:ss") is because while it works for one SharePoint site collection (with the format "yyyy-MM-dd hh:mm tt" ), it throws error on other site collection.:
Invalid Data '2022-02-17 12:29:03' for the field 'Created', Error:
Enter a date and time like this: 2/23/2012 2:25 PM
where the dates with the format "MM/dd/yyyy hh:mm:ss" seem to work, which is quite weird.
I have verified, both site collections have identical regional settings.
Is there any universal date format to convert the date into, that I am missing?
Any help is appreciated.
Answering my own question, in case it may help future visitors:
I somehow overlooked the 'locale' setting in site's regional settings. In my case both sites are having different locale which is most likely the cause. So, I am wondering if there's a universal date format e.g. ISO 8601 string (that doesn't work btw) or something that I can use to convert dates into OR custom mapping (site's locale -> Date format) is the only solution for date column update

How to customize SOQL date format

When i select the data from salesforce using the SOQL, am getting the date format as 'YYYY-MM-DDThh:mm:ss-hh:mm' for a date column.
How cam we customize this date value to this format 'YYYY-MM-DD HH24:MI:SS' ?
You can't apply arbitrary formatting to date-time results in SOQL. By default, you'll receive the ISO8601 format shown in your question.
You may request a formatted date using the FORMAT() SOQL function. The result is
When the FORMAT function is applied these fields reflect the appropriate format for the given user locale. The field format matches what appears in the Salesforce Classic user interface. For example, the date December 28, 2015 can appear numerically as 2015-12-28, 28-12-2015, 28/12/2015, 12/28/2015, or 28.12.2015, depending on the org’s locale setting.
You cannot supply a locale or date format to this function. If you need a format other than the user locale, perform this transformation in your client application.

Excel 2010 Convert text string to Full date & 24 hr time

Program: Excel 2010
Issue: External report gives me a text string, I want to convert it to Date & 24 hour time.
141221205535 needs to be:
14/12/21 20:55:35
I have tried text to columns making the result show: YMD
I have then tried using the format cells option: (custom) yy/mm/dd hh:mm:ss
* I receive a string of ######## in the Sample field in the formatting box.
I have tried also just using the date/time version, no seconds
1412212055 needs to be:
14/12/21 20:55
ideally, if possible:
20141421 2055 or 2014/14/21 20:55 I will accept
I can not alter the report as it comes through a 3rd party and I am pulling the date from a 'reference' field. The report, when downloaded, is in CSV and there is no existing formatting on the data.
I need to convert this as my sales report then needs to be sorted by date order.
Note: If I do use the seconds in the string, I get the weird looking scientific number. So i've had to reduce the digits, this isn't ideal, is there a way to avoid the scientific number whilst the process of changing 'text to date' is happening?
Thanks in advance.
I used this formula to convert:
=TEXT(A1,"2000-00-00 00\:00\:00")+0
format result cell in required format, e.g. yyyy/mm/dd hh:mm:ss
If you don't want the seconds in the underlying value you can use this version
=TEXT(LEFT(A1,10),"2000-00-00 00\:00")+0
These formulas work because TEXT function converts your value 141221205535 to a text value 2014-12-21 20:55:35, then, because that is a valid date/time format in Excel the +0 "co-erces" the text value to a serial number representing the correct date/time in Excel.....so you can then simply format the result to display any way you want.
Note that I'm assuming all dates will be in the current (21st) century.....
A formula like this would work -
=TEXT(DATE(LEFT(A1,2),MID(A1,3,2),MID(A1,5,2))+TIME(MID(A1,7,2),MID(A1,9,2),MID(A1,11,2)),"yy/mm/dd hh:mm:ss")
If your format always has 12 digits
You'll need to add the datevalue with the timevalue to get also the HMS
for example (suppose the text is in D5 cell):
=DATEVALUE(LEFT(D5,2)&"-"&MID(D5,3,2)&-MID(D5,5,2))+TIMEVALUE(MID(D5,7,2)&":"&MID(D5,9,2)&":"&RIGHT(D5,2))`

How to convert a date in Excel to ISO 8601 format

I am trying to save a date format in YYYY-MM-DD, for example, 2014-09-01 as a CSV file, but the format reverts back to the M/D/YYYY format when I do.
I tried converting the date as a string in Excel, but every time I open up the CSV file, it's back to the M/D/YYYY format. I need the ISO 8601 date format to be saved in a CSV file. How do I go about doing so?
The basic function is:
=TEXT(A1,"yyyy-mm-ddThh:MM:ss")
Use this to convert your Excel date columns to separate ISO 8601 date columns. Next, copy the ISO 8601 columns onto the originals (paste special: paste values only).
Delete the calculated ISO 8601 columns which now have garbage in them because Excel sucks at ISO 8601 dates.
You now have a transformed CSV or TSV or whatnot. Just save as the original format and ignore the stupid Excel whining about it not being its native file format and how you are going to "lose out" somehow by saving as CSV file and try not to think about the hours of your life Microsoft has stolen with that dumb dialog.
You can set up a cell, example :
Right click on cell > Cell format > Category > Custom > Type > write this :
aaaa-mm-jjThh:mm:ss (french format here)
yyyy-mm-ddThh:MM:ss (english format)
As a note of caution for non-English users. It just took me a while to figure out, that the format string is sensitive to your regional settings / locale. E.g. with my formatting settings to German:
=TEXT(C2;"jjjjMMtt")
(Although the OS and Excel are set to English.)
You could just jump straight to the nuclear option: Change your computer’s "Region and Language" settings to use the "yyyy-MM-dd" short date format.
I copied and pasted #Dirk Bester's formula above:
=TEXT(A1,”yyyy-mm-ddThh:MM:ss”)
but it wouldn't work, Excel 2010 complaining high and low. That is, until I changed the quote marks from some kind of "smart quote" to plain old ASCII 0x22 quote marks:
=TEXT(A1,"yyyy-mm-ddThh:MM:ss")
And now it works like a charm.
I believe you may well have created the right format in the .csv file.
But that Excel is automatically coercing that into a date value of the format you mention when you open the .csv file. A solution may be to import the .csv file rather than open it, and at step 3 of Get External Data, From Text, ensure that Text is selected for Column data format, where appropriate.
FWIW, none of the above worked for me in an Excel with 16th century dates, e.g. 26-08-1558 for the 26th of August 1558. So in order to convert that to an ISO date, I used:
=RIGHT(D2|4)&"-"&MID(D2|4|2)&"-"&LEFT(D2|2)
=DATEVALUE(LEFT(A1;10))
I used that

Figuring Excel date format programmatically

I have a program that gets input in the form of an excel which it reads by querying (select * into a dataset).
The excel is created by the customer.
The excel contains a date column.
The problem is, that when looking into the dataset, the date column format is sometimes like mm/dd/yyyy and sometimes dd/mm/yyyy. (1/25/1970) (25/1/1970)
I guess it depends on the locale on the machine which the excel was made.
How can my program know what is the date format in the excel?
Not sure whether your question is about output or input...
For output:
You did not mention the database type. But the rule is: make your dates the american way: mm/dd/yyyy. For Jet, I generally use Format(MyDate, ""\#dd\/mm\/yyyy\#"")
("\" is the escape character, it makes sure the next character is output "as is")
For input:
Try reading the cell format ? range("a1").NumberFormat
However on my PC, with French setup a date displayed as 15/2/2011 has a returned format = m/d/yyyy so little use here !

Resources