MongoDB create date get month issue? - mongodb

Can someone please shed some light on why when I create a date object I receive the wrong month like so:
new Date("2013-11-25").getMonth()
output> 10
new Date("2013-11-25").toISOString()
output> 2013-11-25T00:00:00.000Z
I've seen this happen a couple of times and it's confusing me slightly. Is it a bug or am I missing something?

It is correct. This happens because in javascript month start from 0 not 1.
You can read in details here.

Related

In Jaspersoft Studio, how do I use the DATEFORMAT() function?

Here's a screenshot:
Here's a screenshot http://www.coletrumbo.com/wp-content/uploads/2015/05/dateformat-1024x575.png
I'm trying to turn the current date into July 1st of the current year using DATEFORMAT(). I learned how to do that in MySQL from this question, and I hoped it would work similarly in Jaspersoft Studio- turns out date_format( curdate(), '%Y-07-01' ) doesn't translate into
DATEFORMAT( TODAY(), '%Y-07-01' ) or DATEFORMAT( TODAY(), YY/07/01 ). Neither worked.
I could keep trying to get creative and hopefully find something that works, but I'd rather actually understand how to use DATEFORMAT().
I checked the Jaspersoft Studio User Guide, but it's not there. From the prompts on the screen, it makes a lot of sense, but I just can't figure out the "format pattern" that I'm allowed to apply, or even how to correctly write any format pattern at all. Also, this conveniently named question, DateFormat Pattern, didn't actually help at all. And community.jaspersoft.com/answers is kind of a joke in my opinion. When I checked it a couple days ago, it was filled with spam linking to live hockey games.
Thanks in advance. I'm sure this is a beginner level question, so I feel dumb asking it, and I feel like I'm wasting other people's space and time with it because I should already know. So I really appreciate your willingness to care.
I am using the following to get the todays date in a danish format
"Dato: "+new java.text.SimpleDateFormat("dd MMMM yyyy",new
Locale("da", "DK")).format(new Date())
you can find the source code for the DateTime functions directly in JR repository: https://sourceforge.net/p/jasperreports/code/ci/master/tree/jasperreports/demo/samples/functions/src/net/sf/jasperreports/functions/standard/DateTimeFunctions.java
As you can see the code is fairly simple and relies on the Joda Time library.
Therefore the second parameter you are trying to enter is a String, while the first one is a Date object.
Indeed something that could work for you is an expression like this DATEFORMAT(TODAY(), "07-01-YYYY")
Regards,
Massimo.

DATEDIF statement in SharePoint not working properly

I am trying to calculate the amount of days between two dates but my formula doesn't seem to be working properly. It's as is the function is ignoring the years in the dates. My function is as follows:
=IF([Today's date]>[Expiration Date],-DATEDIF([Expiration Date],[Today's date],"d"),(DATEDIF([Today's date],[Expiration Date],"d")))
I receive this error if I use the above function(Owners removed):
But then I replace -DATEDIF([Expiration Date],[Today's date],"d") with -DATEDIF([Today's date],[Expiration Date]"d") i get this result:
This is telling me that both cases are being treated as IF([Today's date]>[Expiration Date] even though 3/24/2015 is clearly larger than 11/03/2014. Can somebody please tell me what I'm doing wrong? Thanks.
=[ExpirationDate] - [TodaysDate]

Get date value from crystal report

I've get value "SDFE12:56" from database, but in my report, i only want to show 12:56 under the colume Time. Is there a way to do that? I've already tried by Ctime()function. but it seems not working
thanks
try val function
val(SDFE12:56)
if you want check link
In the same lay as your other question
Mid ("SDFE12:56",4 ,5 )
or because it is at then end you can do
Mid ("SDFE12:56",4)

How to get date in Scheme/Racket?

I have been trying to write Scheme code to get the date and store the month in a variable, but have no clue how, even after reading the online manual.
What I understand now is there is a struct called Date that needs 10 arguments, but not sure how to retrieve the month, or even date, from the library..could anyone please enlighten me on this.
Thank you.
I found it..
(let ((date (seconds->date (current-seconds))))
(display (date-month date)))
working the manual took more effort than i thought.

Classic Asp Date

Hey, been looking for a while but I can't seem to find any info on how to handle date in classic asp.
For now, I need a way to calculate the number of days passed in the current year. I was thinking about a simple function that would take the current date, then make another date with (day = 1, month = 1, year(now)). And finally get the datediff(day) for these two. Easy enough, but I can't figure out how to do this. Help is appreciated!
Perhaps this example can help you? https://web.archive.org/web/20211020135923/https://www.4guysfromrolla.com/webtech/110398-1.shtml
DateDiff("d",DateSerial(Year(Now),1,1),Date)