File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
77warrant a full blog post. These are mostly things I learn by pairing with
88smart people at [ Hashrocket] ( http://hashrocket.com/ ) .
99
10- _ 316  TILs and counting..._ 
10+ _ 317  TILs and counting..._ 
1111
1212--- 
1313
@@ -137,6 +137,7 @@ _316 TILs and counting..._
137137-  [ Create A Composite Primary Key] ( postgres/create-a-composite-primary-key.md ) 
138138-  [ Create hstore From Two Arrays] ( postgres/create-hstore-from-two-arrays.md ) 
139139-  [ Creating Conditional Constraints] ( postgres/creating-conditional-constraints.md ) 
140+ -  [ Day Of Week By Name For A Date] ( postgres/day-of-week-by-name-for-a-date.md ) 
140141-  [ Day Of Week For A Date] ( postgres/day-of-week-for-a-date.md ) 
141142-  [ Default Schema] ( postgres/default-schema.md ) 
142143-  [ Defining Arrays] ( postgres/defining-arrays.md ) 
Original file line number Diff line number Diff line change 1+ # Day Of Week By Name For A Date  
2+ 
3+ In [ Day Of Week For A Date] ( day-of-week-for-a-date.md ) , I explained how to
4+ determine what day of the week a date is as an integer with PostgreSQL. This
5+ used the ` date_part() `  function. By using the ` to_char() `  function with a
6+ date or timestamp, we can determine the day of the week by name (e.g.
7+ Monday). For instance, to determine what day today is, try a statement like
8+ the following:
9+ 
10+ ``` sql 
11+ >  select  to_char(now(), ' Day'  );
12+   to_char
13+ -- ---------
14+  Sunday
15+ ``` 
16+ 
17+ The ` Day `  part of the second argument is just one of many template patterns
18+ that can be used for formatting dates and times.
19+ 
20+ See [ Data Type Formatting
21+ Functions] ( http://www.postgresql.org/docs/current/static/functions-formatting.html ) 
22+ in the Postgres docs for more details.
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments