| 
Written by Arash Karimzadeh    | 
        
        
          | Friday, 15 May 2009 16:17 | 
        
        
          | 
             dateNet is a jQuery function which is two-way time converter.Can convert javascript Date object to .Net date format which can be passed to dotNet services (.svc files). It also can convert back the date parameters which are send from server in json object to javascript Date object. 
            Download dateNet
            Current version is 1.0.0 
            You can get it here. 
            dateNet
            
              - Formats
 
              - Examples & Downloads
 
             
            Formats
            $.dateNet(date);
            
              - 
date can be javascript Date object or can be dotNet jsonized date.
 
             
            Examples
            
              - Assume that you recieved a {'d':'/Date(1242404957298)/'} as your .Net (c# or vb) service result.
 
                
                  
                  
                    - 
                      
                        var svcPostBack = {'d':'/Date(1242404957298)/'};
                       
                     
                    - 
                      
                        var javascriptDateObject = $.dateNet(svcPostBack.d);
                       
                     
                   
                  
                  
                  
                  
                    var%20svcPostBack%20%3D%20%7B%27d%27%3A%27%2FDate%281242404957298%29%2F%27%7D%3B%0Avar%20javascriptDateObject%20%3D%20%24.dateNet%28svcPostBack.d%29%3B
                   
                 
               
              - If you want to send a javascript date object to service which is a svc file or any other c#/vb service
 
                
                  
                  
                    - 
                      
                        var dateObject = new Date();
                       
                     
                    - 
                      
                        var svcAcceptableDateFormat = $.dateNet(dateObject);
                       
                     
                    - 
                      
                        //and post it to server in json format
                       
                     
                   
                  
                  
                  
                  
                    var%20dateObject%20%3D%20new%20Date%28%29%3B%0Avar%20svcAcceptableDateFormat%20%3D%20%24.dateNet%28dateObject%29%3B%0A%2F%2Fand%20post%20it%20to%20server%20in%20json%20format
                   
                 
               
             
            Tags: C # | dateNet | jQuery | Plugin 
           | 
        
        
          | Last Updated on Monday, 27 September 2010 12:39 |