moment([2007, 0, 29]).fromNow(); // 4 years ago
moment([2007, 0, 29]).fromNow(showSuffix: false); // 4 years
Emulates http://momentjs.com/docs/#/displaying/fromnow/
Namespace: MomentSharpAssembly: MomentSharp (in MomentSharp.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static string From(
this Moment moment,
DateTime dateTime = null,
bool showSuffix = true
)
<ExtensionAttribute>
Public Shared Function From (
moment As Moment,
Optional dateTime As DateTime = Nothing,
Optional showSuffix As Boolean = true
) As String
public:
[ExtensionAttribute]
static String^ From(
Moment^ moment,
DateTime dateTime = nullptr,
bool showSuffix = true
)
[<ExtensionAttribute>]
static member From :
moment : Moment *
?dateTime : DateTime *
?showSuffix : bool
(* Defaults:
let _dateTime = defaultArg dateTime null
let _showSuffix = defaultArg showSuffix true
*)
-> string
Parameters
- moment
- Type: MomentSharpMoment
Moment - dateTime (Optional)
- Type: SystemDateTime
Uses DateTime.UtcNow if not provided - showSuffix (Optional)
- Type: SystemBoolean
Shows "number part ago" or "in number part"
Return Value
Type:
StringLocalized string e.g. 4 years ago
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
Moment. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also