Get the local date format as a string [duplicate] - cocoa

This question already has answers here:
Date formats from device based on locale
(5 answers)
Closed 5 years ago.
I want a method that returns the local date format as a string.
E.g., the method would return the string "dd/MM/yyyy" for UK users and "MM/dd/yyyy" for USA users.

What you are looking for is NSDateFormatter's dateFormatFromTemplate:options:locale: method. This takes a template containing the elements of the date you wish included and returns the appropriate format for the supplied locale.

Related

can not set double field to null value JPA [duplicate]

This question already has answers here:
Why can't primitive data types be "null" in Java?
(8 answers)
Closed 3 years ago.
#Column(name="NU_MAGASIN")
private short nuMagasin;
i create entities from table and this column in my db got null value but the didn;t accept it
and i got this message
Can not set short field supplycam.entities.Nomenclature.nuMagasin to null value
To have an answer on this question I add the code how it must look like:
#Column(name="NU_MAGASIN")
private Short nuMagasin;
In Java short, int, long, float, double, byte, char, boolean are primitive types and not nullable. But there exists a wrapper type for each of these. Usually starting with a capital letter.

Case insensitive oracle query [duplicate]

This question already has answers here:
Oracle DB: How can I write query ignoring case?
(9 answers)
Closed 4 years ago.
I am working with database where i need to retrieve distinct values. Example [English enGLish english ....] all this should be displayed as English only. Can anyone tell me how to achieve this.
Thanks in advance
Looks like you need function initcap():
demo
select distinct initcap(column_name) from your_table

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.

Comparing dates in Xpath with different formats

I have a date in this format "21-Mar-2014"
I already tried to search for Xpath formulas but with no use
I am getting the first format 21-Mar-2014 using SeleniumIDE and want to check if this value is the date of today,
So how can xpath generate today's date and compare it for the date extracted using Selenium
You can parse the string into a date with an xpath function such as date:date(string) (described in this question).
Today's date already in xml date format is supplied by fn:current-date() (see here)
You can get the value, sore it in a variable, and then compare it. Eg:
storeText //xpath/goes/here myDate
storeEval (new Date(storedVars['myDate']) > new Date()) isAfterToday
Note, the storedVars array holds all the variables.
new Date should parse most formats, otherwise you can use any javascript in the storeEval stage to reformat it.

Using sinatra, how do I construct a proper DateTime value from 3 separate input boxes?

How do I take a numeric month, day and year from three separate text inputs and parse a proper value for my DateTime field in the db?
date = Date.civil(params[:year].to_i, params[:month].to_i, params[:day].to_i)

Resources