added more details
This commit is contained in:
		
							parent
							
								
									612c9d3d63
								
							
						
					
					
						commit
						8d401e72b1
					
				
							
								
								
									
										16
									
								
								README.md
								
								
								
								
							
							
						
						
									
										16
									
								
								README.md
								
								
								
								
							| 
						 | 
				
			
			@ -3,6 +3,9 @@ gocronexpression
 | 
			
		|||
 | 
			
		||||
Go language (golang) cron expression parser. Given a cron expression and a time stamp, you can get the next time stamp which satisfy the cron expression.
 | 
			
		||||
 | 
			
		||||
The reference documentation for this implementation is found at
 | 
			
		||||
https://en.wikipedia.org/wiki/Cron#CRON_expression
 | 
			
		||||
 | 
			
		||||
Install
 | 
			
		||||
-------
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +21,14 @@ Import the library:
 | 
			
		|||
 | 
			
		||||
Simplest way:
 | 
			
		||||
 | 
			
		||||
    ...
 | 
			
		||||
    nextTime := cronexpression.NextTimeFromCronString("* * 29 2 *", time.Now())
 | 
			
		||||
    nextTime := cronexpression.NextTimeFromCronString("0 0 29 2 *", time.Now())
 | 
			
		||||
 | 
			
		||||
Assuming `time.Now()` is "2013-08-29 09:28:00", then `nextTime` will be "2016-02-29 00:00:00".
 | 
			
		||||
 | 
			
		||||
If you need to reuse many times a cron expression in your code, it is more efficient
 | 
			
		||||
to create a `CronExpression` object once and keep a copy of it for reuse:
 | 
			
		||||
 | 
			
		||||
    cronexpr := cronexpression.NewCronExpression("0 0 29 2 *")
 | 
			
		||||
    nextTime := cronexpr.NextTime(time.Now())
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
Assuming *time.Now()* is "2013-08-29 09:28:00", then *nextTime* will be "Monday, February 29, 2016 00:00:00".
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue