Datetimes in Kibana Off By One Month - datetime

I have two dates in my _type in Kibana. When I find my documents in the Discover tool, the date shown is one month earlier than it should be. Here, I should see February in the Table view:
When I switch to the JSON view, I it looks like my date is correct:
Kibana is using the incorrect January date in all visualizations as well.
Here is the mapping I'm using for my dates:
{ "type": "date", "format": "YYYY-MM-DD HH:mm:ss" },
What have I done wrong?

Your format on your date/time is wrong.
You are using YYYY-MM-DD instead of yyyy-MM-dd.
Specifically it's having issues because DD means "day of year", so it's always in January.

Related

bootstrap-datepicker shows the wrong month (month select)

I'm using the bootstrap-datepicker and I'm running in to this weird issue.
it works fine, but when I selects a month (E.g May) it shows the selected month as March. (2 months back), Always there is a 2 months gap between,
What is in the date select and months shown in the date-picker popup.
My date-picker is set to only show months and it starts from 1 Jan 2018,
and following is the config
var date = new Date('January 1, 2018');
$('.datepicker').datepicker({
format: "MM yyyy",
minViewMode: 'months',
autoclose: true,
startDate: date
});
What seems to be going wrong here ?
$('.datepicker').datepicker({
format: "MM yyyy",
viewMode: "months",
minViewMode: "months",
startDate: new Date('Jan 1, 2018')});
Try this out. This might help you
Although this might not help for your specific scenario, I did run into the same issue when I included the time.
So format of dd/mm/yyyy was doing fine but once I switched to dd/mm/yyyy hh:mm it added 2 months (December instead of October).
All I eventually had to do was switch to the format dd/mm/yyyy hh:ii as shown in the documentation.
That saved me from switching to a newer version (which is still old when looking at it now, but the github project of datetimepicker points to that link).

report builder 3.0 date timestamp expression

I have a report that uses the folowing expression in a date timestamp field to format the date as either US format or European format depending on a Language prompt the user selects:
=iif(Parameters!LANG.Value = "EN", ToDateTime(Fields!TRANS_DATE.Value).ToString("MM/dd/yyyy"), ToDateTime(Fields!TRANS_DATE.Value).ToString("dd-MM-yyyy"))
If he user selects English, April 1st appears as 04/01/16. If they select any other format, the date appears as 01-04-16. Works great.
I would like to do the same thing on another field but I would like to leave the time in the results. So, if the user selects English, the results would display 04-01-16 11:15:23 AM. Otherwise, I would like to see 01-04-16 11:15:23 AM.
Can I modify the expression above to do the same thing but leave the hours and minutes and seconds in the result?
Thanks for your help.......
You need to append this to your datetime format string:
"hh:mm:ss tt"
So in your case:
=iif(Parameters!LANG.Value = "EN", ToDateTime(Fields!TRANS_DATE.Value).ToString("MM/dd/yyyy hh:mm:ss tt"), ToDateTime(Fields!TRANS_DATE.Value).ToString("dd-MM-yyyy hh:mm:ss tt"))

Format Datetime in Business Objects

So I know I can use =FormatDate(MyDate ,"mm/dd/yy") to turn a date into a string. I am then trying to add on a time:
=FormatDate(AdminDate ,"mm/dd/yy") + MyTime
Which works, however, I need to format this back to a datetime field (as I need to compare against a preexisting datetime field). I try using Todate(), but the documentation is very light, and provides very little on what is acceptable in the formatting of the date area, and nothing in the way of time!
I have attempted:
=ToDate(FormatDate(MyDate ,"mm/dd/yy HH:mm:ss") + MyTime ,"mm/dd/yy HH:mm:ss")
but this will only work when there is no time (and it just nulls out the time) and any row with a time will return a #ERROR
Anyone have an insight on formatting datetimes?
Thanks
The correct way to use the FormatDate command to output date and time components together in 12 hour format is:
=FormatDate(AdminDate; "MM/dd/yy hh:mm:ss a")
and in 24 hour format is:
=FormatDate(AdminDate; "MM/dd/yy HH:mm:ss")
Note MM is used in months and mm in minutes.

How do I format time in SSRS to HH:MM AM/PM format?

I was tasked with augmenting the following code to display the time without seconds, and with AM/PM:
=IIF(Fields!New_Date.Value <> "NO CHANGE", FormatDateTime(IIF(Fields!New_Date.Value = "NO CHANGE","1/1/12",Fields!New_Date.Value),DateFormat.ShortDate), "") &
IIF(Fields!New_Time.Value <> "NO CHANGE",FormatDateTime(IIF(Fields!New_Time.Value = "NO CHANGE","00:00",Fields!New_Time.Value),DateFormat.ShortTime), "")
In realizing that FormatDateTime was insufficient for what I was trying to do, I found the following did not work (just looking at the snippit that relates to the time fields), :
Format(IIF(Fields!New_Time.Value = "NO CHANGE","00:00",Fields!New_Time.Value),"HH:mm tt")
Or this
Format(IIF(Fields!New_Time.Value = "NO CHANGE","00:00",Fields!New_Time.Value),"HH:MM tt")
I'm getting the format codes from here.
What am I doing wrong?
So I found that because I was essentially trying to format a textbox, SSRS never really 'knew' that it was a time field. While I'm not 100% sure my reasoning is correct, it does explain why the following works:
Format(CDate(IIF(Fields!New_Time.Value = "NO CHANGE","00:00",Fields!New_Time.Value)),"hh:mm tt")
If your data is in simple textbox(or table cell) you have easer solution.
right click on the textbox > properties :
use the following:
The other answers are correct, but the key difference to know with the format is:
h:mm tt --> 12-hour clock (e.g. 5:30 PM)
hh:mm tt --> 12-hour clock with a leading zero, if necessary (e.g. 05:30 PM)
H:mm --> 24-hour clock (e.g. 1:30 for 1:30 AM)
HH:mm --> 24-hour clock with a leading zero, if necessary (e.g. 01:30 for 1:30 AM)
From Text Box Properties -> Number -> Custom Category:
Try to input this:
dd-MMM-yy hh:mm tt

Reporting Services Expression for Week of Year

I have a Report that I send a parameter to as 'WeekStart'. This is based on a selection a user makes on a datepicker.
I'm using the following to extract the week of the year:
=DatePart("ww", Parameters!WeekStart.Value)
The problem I'm having is that when I pick the day 03/01/2012 (dd/MM/yyyy format), the week of the year is returned as 9, which would technically be true had the date been 03/01/2012 with a dateformat of MM/dd/yyyy.
I've tried using CDate, FormatDateString etc but nothing seems to be working. I either get #Error or it returns as the 9th week of the year.
Any suggestions?
What you can do is this:
use YourDatabase
go
set dateformat dmy
go
That will set the date format for your database, and that should get your DATEPART function working as expected.
SET DATEFORMAT (MSDN)

Resources