View source code
							
							
						
								Display the source code in std/datetime/date.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						std.datetime.date.enforceValid  - multiple declarations
				Function enforceValid
						
				void enforceValid(string units)
				(
				
				  int value,
				
				  string file = __FILE__,
				
				  size_t line = __LINE__
				
				) pure @safe
				
				if (units == "months" || units == "hours" || units == "minutes" || units == "seconds");
						
					
				Parameters
| Name | Description | 
|---|---|
| units | The units of time to validate. | 
| value | The number to validate. | 
| file | The file that the DateTimeExceptionwill list if thrown. | 
| line | The line number that the DateTimeExceptionwill list if
                thrown. | 
Throws
DateTimeException if valid!units(value) is false.
Example
import stdFunction enforceValid
Because the validity of the day number depends on both on the year and month of which the day is occurring, take all three variables to validate the day.
						
				void enforceValid(string units)
				(
				
				  int year,
				
				  Month month,
				
				  int day,
				
				  string file = __FILE__,
				
				  size_t line = __LINE__
				
				) pure @safe
				
				if (units == "days");
						
					
				Parameters
| Name | Description | 
|---|---|
| units | The units of time to validate. | 
| year | The year of the day to validate. | 
| month | The month of the day to validate. | 
| day | The day to validate. | 
| file | The file that the DateTimeExceptionwill list if thrown. | 
| line | The line number that the DateTimeExceptionwill list if
                thrown. | 
Throws
DateTimeException if valid!"days"(year, month, day) is false.
Example
import stdAuthors
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.