Mongodb iso datetime - mongodb

I need to recover date from mongodb iso date formate by angular js. How can I recover this? please help me.
Mongodb iso date: 2013-12-28T08:30:17.795Z
My convert type: 28-12-2013 8:30:17

Maybe something like:
var date = new Date("2013-12-28T08:30:17.795Z");
$scope.displayDate = date.toLocaleString();

I really recommend http://momentjs.com/. they have a good format function.
Ex.
moment('2013-12-28T08:30:17.795Z').format('DD-MM-YYYY HH:mm:ss');
Will give the answer
28-12-2013 08:30:17

Its very easy to get the time as per mongo,
get the value in your controller from the mongoDB.
Use that value to store in the variable.
Convert it to the ISO format easily using .toISOString() method and its done.
Here is sample..
getdate.controller(..){
$scope.fromdate=date.toISOString();
console.log($scope.fromdate);
}
Now you can get in the MongoDB format..

Related

Represent format of the date 2018-01-01T17:11:11.111+06:00 in string

How can I represent format of 2018-01-01T17:11:11.111+06:00 in string?
I've tried yyyy-MM-dd'T'HH:mm:ss.SSS+HH:mm, but it didn't work.
It is needed for range query in elasticsearch using elastic4s.
Let' try:
YYYY-MM-dd'T'HH:mm:ss.SSSz
I suggest to you this app for check the format:
https://esddd.herokuapp.com/

Matlab - isbusday and busdate format change

Would you be able to advise how can i change the format of the date the functions isbusday and busdate are using ?
The functions use US date format by default, but I need them to be in European format dd/mm/yyyy.
I have attempted to use the code below but it is not working.
isbusday('01-01-2015','dd-mm-yyyy')
busdate('01-01-2015','dd-mm-yyyy',1)
Thank you very much.
You want to convert your string to a datetime object. That is where you can control the format:
d = datetime('01-01-2015','InputFormat','dd-mm-yyyy');
isbusday(d)
busdate(t)
See the documentation: https://www.mathworks.com/help/matlab/ref/datetime.html and https://www.mathworks.com/help/finance/isbusday.html

Format date and add month to it

I'm currently working with embarcadero c++, this is the first time I'm working with it so it's completely new to me.
What I'm trying to achieve is to get the current date, make sure the date has the "dd/MM/yyyy" format. When I'm sure this is the case I want to add a month to the current date.
So let's say the current date is 08/18/2016 this has to be changed to 18/08/2016 and then the end result should be 18/09/2016.
I've found that there is a method for this in embarcardero however I'm not sure how to use this.
currently I've only been able to get the current date like this.
TDateTime currentDate = Date();
I hope someone will be able to help me out here.
I figured it out.
After I've searched some more I found the way to use the IncMonth method on this page.
The example given my problem is as follows:
void __fastcall TForm1::edtMonthsExit(TObject *Sender)
{
TDateTime StartDate = edtStartDate->Text;
int Months = edtMonths->Text.ToInt();
TDateTime NextPeriod = IncMonth(StartDate, Months);
edtNextPeriod->Text = NextPeriod;
}
After looking at I changed my code accordingly to this
TDateTime CurrentDate = Date();
TDateTime EndDate = IncMonth(CurrentDate, 1);
A date object doesn't have a format like "dd/MM/yyyy". A date object is internally simply represented as a number (or possibly some other form of representation that really isn't your problem or responsibility).
So you don't have to check if it's in this format because no date objects will ever be in this format, they simply don't have a format.
You will have to do additions/subtractions on the Date object that the language or library gives you, THEN (optionally) you can format it to a human-readable string so it looks like 18/08/2016 or 18th of August 2016 or whatever other readable format that you choose.
It might be that the TRANSFER of a date between 2 systems is in a similar format, but then formatting the date like that is entirely up to you.
As for how to do that, the link you posted seems like a possible way (or alternatively http://docwiki.embarcadero.com/Libraries/Berlin/en/System.SysUtils.IncMonth), I'm afraid I can't give you an example as I'm not familiar with the tool/language involved, I'm just speaking generically about Date manipulations and they should ALWAYS be on the raw object.

Date format in Talend "2006-05-27 17:00:00.000"

I am facing an issue with Talend dates. I have tried several solutions but still an "unparseable date" error persists.
My date format is of the form : "2006-05-27 17:00:00.000"
Can you help me ?
you can use below talendDate function to parse your string into date..
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss.sss","2006-05-27 17:00:00.000")
this would take input as string and return you date.
If you don't handle the conversion yourself in a tMap but just want to use a schema, then: In your mapping configuration in the date field, you can add the following string:
yyyy-MM-dd HH:mm:ss.SSS
to set the correct format mapping for the date string. Otherwise the answer of garpitmzn is the way to go.
you should use this function in talend to fetch date:
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss.SSS","2016-01-12 12:45:00.000")

Convert Formate of internet time to Nsdate Format in Desire

2011-08-06T12:29:10.703+05:30
i have following date that i have convert in this format like
"2011-08-06T12:29:10+05:30"
Here is a nice blog to have a better idea...
A more better explain is on this link
You can see that you need more than one date NSDateFormater for this job