Created
          April 1, 2011 20:15 
        
      - 
      
- 
        Save danieldbower/898772 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | File file = new File("/tmp/time.csv") | |
| //headers | |
| file.append "key; hh:MMxm; HH:MM; hh; HH; MM; ampm;\n" | |
| int key = 0 | |
| (0..23).each{ hour -> | |
| String ampm = "am" | |
| String upperHString = String.format('%02d', hour) | |
| String hString = upperHString | |
| if(12<hour){ | |
| ampm = "pm" | |
| hString = String.format('%02d', hour - 12) | |
| } | |
| if(0==hour){ | |
| upperHString = "00" | |
| hString = "12" | |
| } | |
| (0..59).each{ minute -> | |
| String mString = String.format('%02d', minute) | |
| key++ | |
| file.append "$key; $hString:$mString$ampm; $upperHString:$mString; $hString; $upperHString; $mString; $ampm;\n" | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment