Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Date format in transition (script runner)

Hi community,

I try to put due date in date field during transition. I use this script :

// On récupère la valeur dans le champ date Livré Réal
def champDateLivre = getFieldById( "customfield_10400" )

// On crée un objet date
def dateDuJour = new Date();

// On crée la date du jour
dateDuJour = dateDuJour.format( "d/MMM/yy" );

// On récupère la valeur du champ date livré
def valeurInitiale = getFieldById( "customfield_10400" ).value

// Si la date n'est pas alimentée
if ( valeurInitiale == "" )

// On l'alimente avec la valeur de date du jour

My résult is : 3/Jul/19 but I've got an error that say wrong format. Use d/MMM/yy

But is it.

When I pick the date manualy in calendar, I've got 3/Juil./19

How can I synchronize it ? Exemple force french calendar... or other

1 answer

1 accepted

0 votes
Answer accepted

You can get the datepicker format of the current date based on the current user's language using the following:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.datetime.DateTimeFormatterFactory
import com.atlassian.jira.datetime.DateTimeStyle

def formatterFactory = ComponentAccessor.getComponent(DateTimeFormatterFactory.class)
def localDatePicker = formatterFactory.formatter().forLoggedInUser().withStyle(DateTimeStyle.DATE_PICKER)
localDatePicker.format(new Date())

Thanks for your answer, but it doesn't work. Does it mean that my user have an other language compare to my systeme ?

You'll need to provide more details if you want help.

Are you getting errors/stack traces? 

What date string is inputted in your date field?


This was just an example of how to get the date in the user's format. Try it in the scriptrunner console. 

To apply to your code, you will need to do something like

champDateLivre.setFormValue(localDatePicker.format(new Date()))

I missed the good application.

It's wonderfull, it's work !

Thank you very much Peter-Dave

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Introducing External Collaboration for Confluence

We’re excited to introduce external collaboration for Confluence, now available in early access. It is available to preview for Confluence Cloud Premium and Enterprise customers. (If you're not on ...

239 views 0 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you