Format() публичный Метод

public Format ( System.DateTime date ) : string
date System.DateTime
Результат string
 /// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
 public static Couchbase.Lite.Document CreateTask(Database database, string title, 
     Bitmap image, string listId)
 {
     SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
         );
     Calendar calendar = GregorianCalendar.GetInstance();
     string currentTimeString = dateFormatter.Format(calendar.GetTime());
     IDictionary<string, object> properties = new Dictionary<string, object>();
     properties.Put("type", DocType);
     properties.Put("title", title);
     properties.Put("checked", false);
     properties.Put("created_at", currentTimeString);
     properties.Put("list_id", listId);
     Couchbase.Lite.Document document = database.CreateDocument();
     UnsavedRevision revision = document.CreateRevision();
     revision.SetUserProperties(properties);
     if (image != null)
     {
         ByteArrayOutputStream @out = new ByteArrayOutputStream();
         image.Compress(Bitmap.CompressFormat.Jpeg, 50, @out);
         ByteArrayInputStream @in = new ByteArrayInputStream(@out.ToByteArray());
         revision.SetAttachment("image", "image/jpg", @in);
     }
     revision.Save();
     return document;
 }
Пример #2
0
 /// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
 public static Couchbase.Lite.Document CreateNewList(Database database, string title, string userId)
 {
     var dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
     var calendar = Calendar.CurrentEra;
     string currentTimeString = dateFormatter.Format(calendar.GetTime());
     IDictionary<string, object> properties = new Dictionary<string, object>();
     properties.Put("type", "list");
     properties.Put("title", title);
     properties.Put("created_at", currentTimeString);
     properties.Put("owner", "profile:" + userId);
     properties.Put("members", new AList<string>());
     Couchbase.Lite.Document document = database.CreateDocument();
     document.PutProperties(properties);
     return document;
 }
Пример #3
0
		private string Iso(PersonIdent id)
		{
			SimpleDateFormat fmt;
			fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
			fmt.SetTimeZone(id.GetTimeZone());
			return fmt.Format(id.GetWhen());
		}
Пример #4
0
		public override string ToString()
		{
			StringBuilder r = new StringBuilder();
			SimpleDateFormat dtfmt;
			dtfmt = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy Z", CultureInfo.InvariantCulture
				);
			dtfmt.SetTimeZone(GetTimeZone());
			r.Append("PersonIdent[");
			r.Append(GetName());
			r.Append(", ");
			r.Append(GetEmailAddress());
			r.Append(", ");
			r.Append(dtfmt.Format(Sharpen.Extensions.ValueOf(when)));
			r.Append("]");
			return r.ToString();
		}
Пример #5
0
		private static string HttpNow()
		{
			string tz = "GMT";
			SimpleDateFormat fmt;
			fmt = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss", CultureInfo.InvariantCulture
				);
			fmt.SetTimeZone(Sharpen.Extensions.GetTimeZone(tz));
			return fmt.Format(new DateTime()) + " " + tz;
		}
Пример #6
0
 /// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
 public static Couchbase.Lite.Document CreateProfile(Database database, string userId
     , string name)
 {
     SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
         );
     Calendar calendar = GregorianCalendar.GetInstance();
     string currentTimeString = dateFormatter.Format(calendar.GetTime());
     IDictionary<string, object> properties = new Dictionary<string, object>();
     properties.Put("type", DocType);
     properties.Put("user_id", userId);
     properties.Put("name", name);
     Couchbase.Lite.Document document = database.GetDocument("profile:" + userId);
     document.PutProperties(properties);
     return document;
 }
Пример #7
0
		public virtual string GetAtimeString()
		{
			SimpleDateFormat locale = new SimpleDateFormat();
			return (locale.Format(Sharpen.Extensions.CreateDate(atime)));
		}
Пример #8
0
		private string Get_time_stamp()
		{
			SimpleDateFormat f = new SimpleDateFormat(" 'Last update:' yyyy-MM-dd HH:mm:ss z");
			return f.Format(new DateTime());
		}