How to convert Apr 1/2020 to 2020-04-01 - date

How do I convert Apr 1/2020 to 2020-04-01 in excel?
I tried all of the helps by Microsoft and used format cell for dates. No luck.

Use CDate:
TrueDate = CDate("Apr 1/2020")
? TrueDate
2020-04-01

Related

Dateparse MON in Tableau

I have a data source that returns a date as a string in the form of 'MON YYYY' (APR 2014, MAY 2014, etc.).
I tried making a calculated field off of this information with the following formula:
DATEPARSE('MMM YYYY', [Field1])
This is a sample set of the data I'm getting (I added the pipe as a divider):
Field1 || Calculated Field
APR 2014 || 12/22/2013
APR 2015 || 12/28/2014
APR 2016 || 12/27/2015
AUG 2014 || 12/22/2013
AUG 2015 || 12/28/2014
AUG 2016 || 12/27/2015
I've also tried to add a day field, but that results in the same incorrect data as above:
DATE(DATEPARSE('dd MMM YYYY','01 ' +[Field1]))
Is there something I'm perhaps misunderstanding about the dateparse function?
It turns out that YYYY means something totally different than yyyy. The capitalized MMMwas necessary for the MON type description. This worked for me:
DATE(DATEPARSE('MMM yyyy',[Field1]))
If you date the date off you'll get the hour, minute, second fields as well.
Dateparse converted it from a string [Field1] into a Date type using the aforementioned format of three digit month, a space, and a four digit year (e.g. AUG 2014 -> 8/2/2014).

Angular2 - convert unfortunately date

I have a problem - I use c# Web.api and Angular2. Thats works but Angular convert the date which I do not want / need. The date of the database is correct and angular add 1 hour
{{item.createdate | date:'H:mm' }}
So it shows 20:30 instead of 19:30 which is stored in the database :(
This is part of json repsone:
"createdate": "2016-11-29T19:30:00",
How can I solve this?
Thank you
Ralf
The Reason is there's no timezone information in the datetime string from the database result.
var date = new Date('2016-11-29T19:30:00');
console.log(date); //Tue Nov 29 2016 20:30:00 GMT+0100 (CET)
Written in the Angular2 documentation about the Date Pipe here.
The expression expects a valid datestring format:
YYYY-MM-DDThh:mmTZD (eg 2016-11-29T19:30+01:00)
var date = new Date('2016-11-29T19:30+01:00');
console.log(date); // Tue Nov 29 2016 19:30:00 GMT+0100 (CET)

How to format a date in Ext JS 3?

I have a date value like this ;
Date {Fri Feb 13 2015 02:00:00 GMT+0200 (GTB Standart Saati)}
I get it from a grid column with ;
selectionModel.getSelected().data['date'];
And column model date format is 'd/m/Y'. It shows in grid well (d/m/Y).But when i get selected value it returns a date format doesn't like 'd/m/Y'. How can i format this date to set to a textfield ?
According to ExtJs Docs
var d = new Date(1993, 6, 28, 14, 39, 7);
println(d.toString()); // prints Wed Jul 28 1993 14:39:07 GMT-0600 (PDT)
println(d.toDateString()); // prints Wed Jul 28 1993
Edit:
Please use Ext.Date.format to format the date:
Ext.Date.format(d,'d/m/Y');
According to ExtJS 3.4 Docs Date object is extended with .format() method.
So you should be able to just do
var d = new Date();
d.format("d/m/Y");

Extjs Grid updating Issue in Date Field

I have 3 datefield in grid and when I am updating anything in row, it shows red mark on date field that means date fields are also modified but I am not making any change in any date field.
I tried to find out problem and I got following reason:
context.originalValues.dateCreated : 11/10/2014
context.originalValues.dateModified : 11/10/2014
context.originalValues.lastLogin : 11/10/2014
and
context.newValues.dateCreated : Mon Nov 10 2014 00:00:00 GMT+0530 (IST)
context.newValues.dateModified : Mon Nov 10 2014 00:00:00 GMT+0530 (IST)
context.newValues.lastLogin : Mon Nov 10 2014 00:00:00 GMT+0530 (IST)
so, grid shows these dates columns are updated. Is there any way to solve this issue.
Thanks in Advance.
Solved the issue :)
The date in store was in string format so created date object in Store, and now it is working fine. I used following codes to create date object in store.
{
name: 'lastLogin',
type: 'date',
dateFormat: 'n/j/Y',
convert: function (newValue, model)
{
return new Date(model.get('lastLogin'));
}
}

JavaFX8 Convert String to date using DateTimeStringConverter

I would like convert string to date (dd/MM/YYYY) - this is useful for compare dates in TableColumns.
so i use DateTimeStringConverter (the string "01/11/2014" is a value of DatePicker)
DateTimeStringConverter format = new DateTimeStringConverter(Locale.FRANCE,
"dd/MM/YYYY");
Date d1 = format.fromString("01/11/2014");
d1.toString()
I don't obtain the right date but this date = "Mon Dec 30 00:00:00 CET 2013" !!!
I don't understand what is the problem (which in fact should not be a problem) ?
Any ideas ?
Thank you in advance
Fabrice