How to call ICU APIs to give ISO date time format instead of default locale based values - datetime-format

Like to get ISO date-time value for option day of week.
https://unicode-org.github.io/icu/userguide/format_parse/datetime/
e local day of week
example: if Monday is 1st day, Tuesday is 2nd ) e or ee
eee
eeee
eeeee
eeeeee 2
Tue
Tuesday
T
Tu
ISO 8601, Monday is the first day of the week. If default locale is en_US, then Sunday become 1st day.
Eg. 2020-10-05, Monday with option 'e' give 2 because my locale is US. I don't see option to force ISO and ignore default locale in https://unicode-org.github.io/icu/userguide/format_parse/datetime/

Related

Is it possible to get a long date in the current locale?

I can pass the result of nl_langinfo(D_FMT) to strftime to get a date string formatted according to the rules of the currently active locale. This works fine but it only allows me to get a short date, e.g. 21.01.2023 for January 21st, 2023 on a German system. On Windows I can also query LOCALE_SLONGDATE to get a long date, which would be something like Samstag, 21. Januar 2023 for January 21st, 2023 on a German system.
Is there any way to get such long date strings formatted according to the rules of the current locale on Linux?

Get week number based on ISO8601

Is there any way in SQL Server to get week number based on specific date which would reflect
according to ISO8601 where Monday is the first day of week?
Just use the aptly named ISO_WEEK Datepart:
iso_week datepart
ISO 8601 includes the ISO week-date system, a numbering system for weeks. Each week is associated with the year in which Thursday occurs. For example, week 1 of 2004 (2004W01) covered Monday, 29 December 2003 to Sunday, 4 January 2004. European countries / regions typically use this style of numbering. Non-European countries / regions typically do not use it.
SELECT DATEPART(ISO_WEEK,YourDate)
FROM dbo.YourTable;

Extended calendar which runs on 1st business day of 3rd of every month in autosys

I need to create extended calendar which will run on 1st business day of 3rd week of every month.
Mon to Fri are considered as working day and no holiday calendar included.
Sample dates for year 2018 :
16th Jan, 13th Feb, 13th Mar, 17th Apr, 15th May, 12th Jun, 17th Jul, 14th Aug, 11th Sep, 16th Oct, 13th Nov, 11th Dec
Currently I am using standard calendar for this but wants to change it to extended calendar to avoid manual inserts for every year.
#Manvi
not very confident of the exact condition and this would be a partial answer.
as for now i can think of
WEEK#03|WEEK#07|WEEK#11|WEEK#15|WEEK#20|WEEK#24|WEEK#28|WEEK#33|WEEK#37|WEEK#42|WEEK#46|WEEK#50
This would give you all the 3rd week of the the months and then hereon need to exclude the rest of the days.
You can refer this link for condition keywords.
Also, you can use below to include multiple keywords for desired output.
OR condition as "|"
NOT as "NOT"
Hope this helps. Good luck.
Will update incase i do find the solution.
Edits:
The first working day would definitely be a Monday and the previous day has to be 2nd Sunday.
Consider a calender as below
extended_calendar: Cal_name
description: 1st day of the 3rd week
workday: mo,tu,we,th,fr
non_workday:
holiday:
holcal:
cyccal:
adjust: +1
condition: sun#2
Sun#2 would consider the 2nd sunday of all months and the next day would mark the start of the 3rd week.
To consider the next day of the 2nd sunday adjust: +1 defined.
If you are looking for the 2nd day of the 3rd week. Defined adjust to +2.

Angular localization problems with number and date format

I am trying to format a date based on localisation and have the locale files setup correct so when using date format of shortDate I get the difference between UK and US format.
However we need the date to show the full year 2016 and not 16.
If I code it as dd MM yyyy then that gives me the correct UK format but when toggling to US mode the filter keeps it in that dd MM yyyy format.
How can I enable the date to be of type day month year for UK and month day year for US etc ?
Try https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString
// US English uses month-day-year order
console.log(date.toLocaleDateString('en-US'));
// → "12/19/2012"
// British English uses day-month-year order
console.log(date.toLocaleDateString('en-GB'));
// → "20/12/2012"
Note this is not IE friendly like most of html5 and ES6 :v.
other way is to use http://momentjs.com/

gae cron job for last day of every month

I want the schedule of a cron job to be the las day of every month. I've used this:
<schedule>last day of month 23:59</schedule>
Is it correct?
The easiest way to launch the job at first of month 00:00. You may tweak it to run few hours before setting the <timezone> to the timezone with more positive value than the desired one. If desired timezone is GMT than you may set the timezone of the cron job to Europe/Berlin and the job will be executed last day of the month at 23:00 GMT.
As per the documentation, the format for the Cron Expression for the kind that you are trying to create is:
("every"|ordinal) (days) ["of" (monthspec)] (time)
Where:
ordinal specifies a comma separated list of "1st", "first" and so forth (both forms are ok)
days specifies a comma separated list of days of the week (for example, "mon", "tuesday", with both short and long forms being accepted); "every day" is equivalent to "every mon,tue,wed,thu,fri,sat,sun"
monthspec specifies a comma separated list of month names (for example, "jan", "march", "sep"). If omitted, implies every month. You can also say "month" to mean every month, as in "1,8,15,22 of month 09:00".
time specifies the time of day, as HH:MM in 24 hour time.
I don't think there is a direct expression for what you are trying to do.
You might need to create multiple cron expressions. For e.g. 31 of month 09:00 would address 31st day of all months at 9:00 AM and it should address all months that have 31 days and so on.

Resources