How do I get the current date in the current users format in Jelly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2015 12:13 PM
In my UI Page I am getting the current date using.
var gdt = new GlideDateTime();
var date = gdt.getLocalDate();
if the user has a date format other than yyyy-dd-mm, system simply picks up wrong data when entering the "date" into database. on the client side i could use "g_user_date_format". What is the best way if getting the date in user's format.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2015 02:28 PM
If you are just trying to print out the current date/time, then you should just be able to use something like this. I tested it in Fuji and it changes the structure accordingly. If it is the user's current session, then it should be fine.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
This should show the date as ${gs.now();}<br/>
This should show the date/time as ${gs.nowDateTime();}
</j:jelly>