[OpenSIPS-Users] Timestamp in date format
xaled at web.de
xaled at web.de
Tue Feb 23 09:59:36 EST 2021
Hi Ben,
thanks for comments and ideas. I was also thinking about something along the
lines.
There is a somewhat similar discussion on the opensips github on extending
$time functionality but unfortunately it did not progress since 2014:
https://github.com/OpenSIPS/opensips/issues/378#issuecomment-61608369
Thanks,
Xaled
From: Users <users-bounces at lists.opensips.org> On Behalf Of Ben Newlin
Sent: Tuesday, February 23, 2021 2:25 AM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] Timestamp in date format
That function only uses the current time. As far as I know there are no
generic time string format functions in OpenSIPS. The only options are to
manipulate the current time only.
You could use exec or one of the language modules like python to do this. Or
you could write to the XML as a timestamp and convert it outside of
OpenSIPS. The latter would be my recommendation if possible.
Ben Newlin
From: Users <users-bounces at lists.opensips.org
<mailto:users-bounces at lists.opensips.org> > on behalf of xaled at web.de
<mailto:xaled at web.de> <xaled at web.de <mailto:xaled at web.de> >
Date: Monday, February 22, 2021 at 5:25 PM
To: 'OpenSIPS users mailling list' <users at lists.opensips.org
<mailto:users at lists.opensips.org> >
Subject: Re: [OpenSIPS-Users] Timestamp in date format
Hi Ben,
found that as well, thank you.
Is there a way to add for example a week to the current datetime to have a
datetime that can be used to say that something is valid until one week in
the future?
If 2013-08-01T12:00:00Z is now then to have 2013-08-08T12:00:00Z
Thanks,
Xaled
From: Users <users-bounces at lists.opensips.org
<mailto:users-bounces at lists.opensips.org> > On Behalf Of Ben Newlin
Sent: Monday, February 22, 2021 10:09 PM
To: OpenSIPS users mailling list <users at lists.opensips.org
<mailto:users at lists.opensips.org> >
Subject: Re: [OpenSIPS-Users] Timestamp in date format
> I know that there is a get_timestamp function but I need the result to be
formatted as date.
You can use the $time variable.
https://www.opensips.org/Documentation/Script-CoreVar-3-1#toc93
$time("%Y-%m-%dT%TZ")
Ben Newlin
From: Users <users-bounces at lists.opensips.org
<mailto:users-bounces at lists.opensips.org> > on behalf of xaled at web.de
<mailto:xaled at web.de> <xaled at web.de <mailto:xaled at web.de> >
Date: Monday, February 22, 2021 at 4:01 PM
To: 'OpenSIPS users mailling list' <users at lists.opensips.org
<mailto:users at lists.opensips.org> >
Subject: [OpenSIPS-Users] Timestamp in date format
Hi,
I need to create a timestamp node in an XML body like shown below
<timestamp>2013-08-01T12:00:00Z</timestamp>
I know that there is a get_timestamp function but I need the result to be
formatted as date.
BTW, is there a way to directly define XML item value using variable
Something like:
$xml(my_doc/doc/list) = "<item>$var(value)</item>";
Unfortunately it does not work like this
Thanks,
Xaled
_______________________________________________
Users mailing list
Users at lists.opensips.org <mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20210223/6ddc4f58/attachment-0001.html>
More information about the Users
mailing list