Results 1 to 5 of 5

Thread: Alphanumeric Dates - Is it possible?

  1. #1
    New user
    Join Date
    06-29-12.
    Posts
    8

    Default Alphanumeric Dates - Is it possible?

    Hi everyone!

    I´ve got this website, made in Contao of course: http://test.gestionpublica.info/socieda ... -rios.html

    You can see at the end of the note, that i´ve put the date automatically from the template, but i really need that date to be alphanumeric, like 'Friday, June 29, 2012' (in spanish it would be something like 'Viernes 29 de Junio de 2012').

    So:
    - is it possible?
    - from where do i have to set it? from the template? from any other parameters?
    - and if you have the solution for spanish dates, it would be great!

    Thanks so much.
    Regards

  2. #2
    User
    Join Date
    06-20-09.
    Posts
    115

    Default Re: Alphanumeric Dates - Is it possible?

    This is from an old post, not sure if it is still relevant but it may point you in the right direction:
    http://en.forum.contao.org/viewtopic...t=1032&start=0
    geung

  3. #3
    New user
    Join Date
    06-29-12.
    Posts
    8

    Default Re: Alphanumeric Dates - Is it possible?

    Thanks!!!
    It worked by using this code:

    <div class="date"><span class="date">
    <?php echo $this->parseDate("l j F", strtotime($this->date)); ?></span>
    <?php if ($this->time): ?> – Kl <span class="time"><?php echo $this->time; ?></span><?php endif; ?>
    </div>


    but i´m still having one problem, that maybe you can help me with.

    You see, now the date displays like this:
    Lunes 2 Julio 2012

    But the spanish correct way is:
    Lunes 2 de Julio de 2012

    Those de are prepositions that dont change, so they have to be always sticked there. How do i do this??

    Sorry for my lack of PHP knowledges

    and thanks again!

  4. #4
    User
    Join Date
    06-20-09.
    Posts
    115

    Default Re: Alphanumeric Dates - Is it possible?

    Hey no problem,
    I'm no PHP expert either, so if I'm totally wrong someone else can hopefully pitch in
    but I had a look around and found out that maybe

    this
    Monday 2nd of July 2012
    equals this:
    Code:
    <?php  echo date("l jS \\of F Y",strtotime("today")); ?>
    and this
    Monday 2 de July de 2012
    equals this
    Code:
    <?php echo date("l j \\d\\e F \\d\\e Y",strtotime("today"));?>
    so you could try this in contao:
    Code:
    <?php echo $this->parseDate("l j \\d\\e F \\d\\e Y", strtotime($this->date)); ?></span>
    who knows, it might work!
    geung

  5. #5
    New user
    Join Date
    06-29-12.
    Posts
    8

    Default Re: Alphanumeric Dates - Is it possible?

    It worked perfectly!
    Thanks geung, best regards.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •