Need to display first four letters of date (freemarker) - freemarker

The copy editors at my job are very specific on how they want the date displayed. The code I use now works perfectly for months abbreviated by three letters. Doesn't work for Sept.
Current code:
${(.now?long - 259200000)?number_to_date?string['MMM. d']}
Is there a way to display the date as Sept xx ?

Related

Dynamic Date Selection Tableau

Here is a sample data that I am working with. I want to make it more dynamic. Meaning, if a user selects a date, I need to display the 7 day, 14 day change based on the selected date. I have created a parameter with the date filter and also created a formula for 7 day change like this : LOOKUP(SUM([Sample]),-7) and LOOKUP(SUM([Sample]),-14)
I tried using these formulas, but it wont work when I filter to a particular date. Any help is appreciated.
Date Sample
7/1/22 491,556
7/2/22 74,027
7/3/22 65,938
7/4/22 74,099
7/5/22 636,580
7/6/22 508,986
7/7/22 630,481
7/8/22 495,756
7/9/22 71,503
7/10/22 64,875
7/11/22 73,174
7/12/22 642,674
7/13/22 517,709
7/14/22 638,848
7/15/22 490,698
7/16/22 68,802

Odoo fields.Date error

I am using fields.Date to enter a particular date to a field. Lets suppose I do not use the date picker and instead choose to enter the date manually, I am encountering following error.
Lets say I input 12/04/17 (mm/dd/yy) it takes it as 12/04/0017 instead of 12/04/2017.
If you want the date (year) to appear as 2 digits, you can change this in the Settings/Translations/Languages - Select Active Language - Date Format.
Change %Y to %y.
If the date is displayed as 2 digits, then entering it in manually as 2 digits appears to work.
Personally, if I try to enter a date manually with the year as 17 (and year displaying as 4 digits) I get an error.

Oracle SQL Output to Excel - Date format issue

I ran an SQL Query for Oracle which consists of Invoice date and Check date. When these data are copied on to an Excel Spreadsheet as text, it's dispayed as ex: "13-10-31" (Oct 31, 2013). However, when converted to date format, it's displayed as "10/13/1931". I've tried different date types but it always recognizes as the first part of the text as the day, then month, then year. I need these values to be setup as a date format as I need to calculate Days Payable Outstanding and other related ratios.
Is there any way to convert these values so that Excel recognizes the day, month, and year correctly? Would there be a macro that could automate this process for existing data and data that will be added in the future?
Thank you in advance.
Firstly, I hope the data type of your date column is DATE.
Secondly, the date should always have year as YYYY and not just YY. The world has already learned from Y2K bug.
If above two points are met, then while displaying use to_char(date_column, 'mm/dd/yyyy'). Thus, with YYYY format, there won't be any confusion between year and other fields.

How did windows/c# remember the current systems year/date

Recently i was working with unit testing for my project.
I've given a task to test the method. The method should return the recent quarter date as per the current system date.
So, I've called the current system date using the following c# code:
string currentYear = DateTime.Now.ToString();
When i run the query it worked as expected.
So, its time for my tactics to raise a bug for that method. Hence I've changed the system date to 10/01/14 (dd/mm/yy).
Also I've customized current system date format to only keep last two digits of the year.
Ex: if year is 2014 the it shows only 14.
You can observe the short date and the long date in the following image.
When i run/debug the test in Visual Studio 2012, it still displays as 2014 as the current system date though I've modified it to 14.
Question: The real question is how did the system/program took the current year as 2014 even the system date is changed to 14. It may be silly but my doubt is Why it is not 1914 or 1814 and why it is 2014 ?.
Where did it store the current date or year information ? Does windows manage this stuff or did the C# taken care of the date ?
The real question is how did the system/program took the current year as 2014 even the system date is changed to 14. It may be silly but my doubt is Why it is not 1904 or 1804 and why it is 2014 ?.
C# only retrieved the date from the system, it was Windows that determined what data to send.
In the case of two-digit dates, Windows allows you to define what they mean in the Regional and Language applet in the Control Panel. This way you can specify the range you want it to represent depending on your usage.
The display of a date is not how it is stored, just how it is displayed.
January, 1st, 2014 may have a multitude of different formats, e.g.
2014-01-01
01-01-2014
01-01-14
1/1/14
Jan/1/14
001-2014
But all are held internally exactly the same way.
Note the advanced settings on your screenshot - this will indicate to many windows programs how to interpret a year entered as 2 digits, so it knows if it should regard a date entered as XX as 19XX or 20XX - this will cover manually entered dates, not the system date
Your C# application didn't store that date, Windows handled it for you.
As Sean mentioned, by changing from YYYY to YY you only changed how the date is displayed, not how it is stored. Windows doesn't store its system time information into a specific date format. Instead, it records the number of 100-milisecond intervals since 00:00 January 1st, 1601. That way it keeps the tracking of time independent of how it's displayed and allows you to display the date and time in a number of different formats.
As a curiosity, that specific date was chosen because the Gregorian calendar operates on a 400-year cycle (when it starts to repeat itself) and 1601 was the first year of the cycle that was active when Windows NT was being developed.
On a side note, Unix systems store that information as Unix Time or POSIX Time, counting the number of seconds elapsed since 00:00 January 1st 1970.

How to change the starting date of a Calendar Year to something other than Jan 1st?

I'm writing an app that relies on the calendar and calendar events to display data to the user.
I need to be able to let the user select the beginning of his/her 'fiscal' year in settings, which will be the 1st of any of the 12 months. This is an app for military users, and any given unit's fiscal year can begin on whatever month their unit (base) decides.
The data I'm displaying to the user needs to be divided into 'fiscal' quarters according to the user's setting of the beginning of the fiscal year, not calendar year.
I'm not having problems retrieving, editing or deleting the events, I can't figure out how to change the beginning of the year to anything besides Jan 1st.
I found NSDateCategoryForReporting on GitHub, that seems like it's exactly what I need, but how do I tell it that the year begins on the 1st of x month?
iOS doesn't natively support this, so you'll have to find a plugin to do this or write your own. Your best bet is to write a class that performs the date conversions using the standard NSDate, NSCalendar, etc.
For instance, you could store what day the user specifies as their starting fiscal year. Then you can calculate the number of days difference between that and January 1st, and just shift dates based on that.

Resources