I am trying to add together a query column of dates and months in access to get an expiration date. I have tried the DateAdd function and it doesn't work.
DateAdd doesn't accept Null, and you can't mix text and dates, so try with:
IIf([dates] Is Null,"No Date", Format(DateAdd("m",[months],Nz([dates],Date()), "yyyy-mm-dd"))
Related
I am trying to extract a numeric month and date from a give hire date to create an annual anniversary date in report builder.
Thus far I have tried the code below:
=Year(Now) +"-"+ Month(Fields!hire_date.Value) +"-"+ Day(Fields!hire_date.Value)
I got a #Error in the field I am trying to populate.
Looks to me like you're simply using the wrong syntax to concatenate the date. Additionally, you could simplify the expression using FORMAT. Try this:
=Year(Now()) & "-" & Format(Fields!hire_date.Value, "MM-dd")
This should return the date in the format 2019-06-21.
For other ways to format the date, see this link.
I am looking for an expression that will allow to me find the date of Monday of the week of my Date Field, to be used in a filter for a tablix.
Example, my date field today is 22/01/2019. I would like an expression that will return 21/01/2019. If the date was 26/01/2019, it should still return 21/01/2019.
For next week 31/01/2019 would return 28/01/2019.
Week starting Monday going to Sunday.
If its also possible for a similiar expression but to find the beginning of the month as well?
Is that possible?
Many thanks
To get the date of last Monday that occurred you can use something like
=Today.AddDays(1-WeekDay(Today(),FirstDayOfWeek.Monday))
and for the first of the month its just
=DateSerial(Year(Today()), Month(Today()), 1)
Both the above are based on the today() function, if you need them based on a date parameter, then the expression is a little different but your question stated "today".
monday of the week use the following expression:
DateAdd("d",DatePart(DateInterval.WeekDay,Fields!myDatefield.Value,0,0)+1,Fields!myDatefield.Value)
first day of the month use the following expression:
=DateAdd("d",-(Day(Fields!myDatefield.Value)-1), Fields!myDatefield.Value)
I am attempting to pull records from a specific period into a form. I need to be able to pull the information from a date field within a table to put into the form. I need it to prompt for a date range and that date range show in the form/report. I am having trouble making this work.
Thanks
The following is an example of selecting a date range using parameters that you specify. It will prompt you to enter a start and end date
AND it will return the dates you selected as fields in the query.
You can use the start/end fields in your form/report.
SELECT [Table1].*, [StartDate] AS MyStart, [EndDate] AS MyEnd
FROM Table1
WHERE ((([Table1].DateAdded) Between [StartDate] And [EndDate]));
I want to pass datetime parameter in such format that it should display today date with time 00.00.00 and todate like today date with time 23.00.00 in ssrs reports.
Misunderstood before, you have to use AddHours, AddMinutes and AddSeconds in parameter's default expression:
=Today().AddHours(23).AddMinutes(59).AddSeconds(0)
UPDATE
You can hide time in following:
=CDate(Format(Today().AddHours(23).AddMinutes(59).AddSeconds(0), "MM/dd/yyyy"))
You can use Format() function to achieve your goal.
=Format(Now(),"dd-MM-yyyy 00:00:00")
=Format(Now(),"dd-MM-yyyy 23:00:00")
I'm trying to extract just the year out of either of the built-in date functions of Informix
TODAY or CURRENT
Is there a way to do this without SUBSTR()?
Yes: use the YEAR function:
SELECT YEAR(TODAY)
FROM SysMaster::SysDual;
Similarly for MONTH, DAY, WEEKDAY (0..6). You could use CURRENT instead of TODAY, but that generates a DATETIME value which is then converted to DATE and then analyzed.