18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Display Date in "YYYYMMDD" Format

vinilnarayanvinilnarayan Members
edited February 2014 in Sahi - Open Source
Hi all...

I want to store system current date in a variable. and the date format should be in "YYYYMMDD". Plz help...

Answers

  • Hi..

    As I tried


    function yyyymmdd()
    {
    var $year;
    var $month;
    var $month1;
    var $today;
    var $icrdate;
    var $fullyear;

    $icrdate = new Date();

    $fullyear=$icrdate.getFullYear().toString();
    $month = $icrdate.getMonth();
    $month1 = parseInt($month);
    $month1 = $month1 + 1;
    $month = $month1;
    if ($month < 10)
    {
    $month = "0" + $month;
    }
    $today = $icrdate.getDate();
    if ($today < 10)
    {
    $today = "0" + $today;
    }

    $datum=$fullyear+$month+$today;
    return $datum;


    But i need a simple way to do this....
  • Its working .. Thank you :)
Sign In or Register to comment.